text-indent br

本文介绍了一种使用CSS实现特定布局的方法,即在一个表格单元格(td)内的元素(span)换行后仍能保持与表格单元格边缘有2像素的距离。文中指出text-indent属性不适用于此场景,而推荐使用padding-left属性来达到预期效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

     设一个 td 内有一个 span  你想换行后还能与 td 有2个像素的距离,光用 text-indent 是不行的。

     text-indent 是首行缩进,可以整体缩进,或者局部缩进,用 padding-left 比较靠谱。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="爱莫音乐,Almo,Almo音乐,音乐网站,爱莫能助" /> <meta name="author" content="15级物联网1班刘曦,黄浩小组" /> <title>Almo音乐,爱莫论坛</title> <link href="Style/forum_css.css" type="text/css" rel="stylesheet" /> </head> <body> <div id="All"> <div class="head"> <div class="logo"></div> </div> <div id="navigate"> <ul> <li style="font-size:24px; float:left; line-height:35px; text-indent:1em;"><a href="index.html" target="_self">首页</a> <li style="font-size:24px; float:left; line-height:35px; text-indent:2em;"><a href="login.html" target="_self">登录注册</a> <li style="font-size:24px; float:left; line-height:35px; text-indent:2em;"><a href="singer.html" target="_self">热门歌手</a> <li style="font-size:24px; float:left; line-height:35px; text-indent:2em;"><a href="#">精选歌单</a> <li style="font-size:24px; float:left; line-height:35px; text-indent:2em;"><a href="#">歌曲分类</a> <li style="font-size:24px; float:left; line-height:35px; text-indent:2em;"><a href="#">畅销专辑</a> <li style="font-size:24px; float:left; line-height:35px; text-indent:2em;"><a href="#">下载专栏</a> <li style="font-size:24px; float:left; line-height:35px; text-indent:2em;"><a href="forum.html">爱莫论坛</a> </ul> <hr /> </div> <div class="main"> <div class="left"> <a href="content1.html" target="_blank"><p>发表帖子</p></a> <a href="#"><p>个人收藏</p></a> <a href="#"><p>推荐歌单</p></a> <a href="#"><p>热歌点评</p></a> <a href="#"><p>上传歌曲</p></a> </div> <div class="right"> <a href="content2.html" target="_blank"><p style="font-size:18px; color:#F00;">2016.11.18 | [置顶]爱莫音乐网站推出,各板块详细介绍。</p></a> <a href="content1.html"><p style="font-size:18px; color:#F90;">2016.12.01 | [热]爱莫下载专栏开放了,你还在等什么!</p></a> <a href="regist.html"><p style="font-size:18px; color:#69F;">2016.12.10 | [热]关于我与爱莫不得不说的十个小秘密。</p></a> <br /><br /> <a href="index.html"><p style="font-size:16px;">更多>></p></a> </div> </div> </div> </body> </html>
04-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值