CSS 链接间距和段落间距
这是网站:
http://wesbos.com/tf/shutterflow/?cat=1
侧面的横幅图像显示 S&S 摄影,在底部添加了几个像素的边距。仅当我将其链接到 URL 时才会发生这种情况。
滚动图像即可查看突出显示的文本。这很有效,除了我想在行尾添加一些填充。普通 CSS 填充仅将其应用于 P 标签的开头和结尾。我的代码需要这样格式化:(除非有人知道如何用每行作为段落标签来欺骗这种效果
。对于格式设置,编辑器出于某种原因不允许我将代码放在多行上。
<p>hey hows it going<br/> this one is<br/> short and this one is longer<br/> will this text<br/> </p>
.cover p {
display: inline;
color: #000;
background-color: #fff;
padding:5px;
}
Here is the site:
http://wesbos.com/tf/shutterflow/?cat=1
The banner image at the side that says S&S photography adds a margin of a few pixels to the bottom. This only happens when I link it to a URL.
Rollover an image to see the text that is highlighted. This works great except I would like to add some padding to the end of the lines. Normal CSS padding only applies it to the start and end of the P tags. My code needs to be formatted like this: (unless someone knows how to dupe this effect with each line being a paragraph tag
Sorry for the formatting, the editor wont let me put code on multi lines for some reason.
<p>hey hows it going<br/> this one is<br/> short and this one is longer<br/> will this text<br/> </p>
.cover p {
display: inline;
color: #000;
background-color: #fff;
padding:5px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要消除横幅图像底部的额外空间,请使用:
图像默认垂直对齐方式是基线,为文本下降部分留出空间。
To get rid of the extra space at the bottom of your banner image, use:
Images default vertical alignment is baseline which leaves room for text descenders.
对于侧边栏:
将图像设置为
display:block;
以删除多余的空间。由于您的其他样式,您还必须向图像添加clear:both;
或删除顶部ul
上的浮动(它所做的只是清除浮动的li
,您可以使用overflow:hidden;
来代替)。对于悬停文本:
您必须使用单独的段落来进行填充,但这在 WP 中很容易做到。如果您使用 float 而不是 display,则不需要在每个末尾添加额外的
:当然,我会保留
display: inline;
以及您漂浮的任何地方。它解决了 IE5/6 双倍浮动边距错误。但这是另一个问题。For the sidebar:
Set your image to
display:block;
to remove the extra space. Because of your other styles you will also have to add eitherclear:both;
to the image as well or take away the float on your topul
(all it's doing is clearing the floatedli
's, which you can do usingoverflow:hidden;
instead).For the hover text:
You will have to use separate paragraphs to get padding, but that is easy to do in WP. You don't need the extra
<br />
at the end of each if you use float instead of display:Of course, I would leave the
display: inline;
as well anywhere you are floating. It takes care of the IE5/6 doubled float-margin bug. But that is a different issue.您需要将每一行包装在一个元素中。跨度将是一个不错的选择:
然后您可以将填充添加到跨度元素。
You'll need to wrap each line in an element. A span would be a good choice:
You can then add your padding to the span elements.
您应该能够在每行都是
的情况下执行此操作,但您必须添加额外的
在每个末尾:
HTML:
CSS:
我在这里上传了一个演示: http:// demo.raleighbuckner.com/so/1303628/
You should be able to do this with each line being a <p>, but you will have to add an extra <br> at the end of each one:
HTML:
CSS:
I uploaded a demo of this here: http://demo.raleighbuckner.com/so/1303628/