[英]How do I put the text line under an image tag?
If all else fails, try creating a table and inserting the text in the rows beneath the image. 如果所有其他方法均失败,请尝试创建表并将文本插入图像下方的行中。 You may have to modify text-align to display it how you want.
您可能必须修改text-align才能以所需的方式显示它。
From CSS Selectors Level 3 从CSS选择器3级
The ::before and ::after pseudo-elements can be used to describe generated content before or after an element's content.
:: before和:: after伪元素可用于描述元素内容之前或之后生成的内容。
So, ::before
and ::after
will just work on elements which have a content and not work on input
, br
, others and also not img
. 因此,
::before
和::after
将仅对具有内容的元素起作用,而对input
, br
,其他元素和img
不起作用。
As someone said, wrap your image inside another element, a div
or whatever you like, and apply it any pseudo-element via CSS. 就像有人说的那样,将您的图片包装在另一个元素,
div
或您喜欢的任何内容中,然后通过CSS将其应用于任何伪元素。
Note If the text is important, non-decorative, you should not use a pseudo-element for that. 注意如果文本是重要的,非装饰性的,则不应为此使用伪元素。
You can use pure css to hack the <hr>
tag to make it vertical: Example Fiddle 可以使用纯的CSS破解的
<hr>
标签,使其垂直: 实施例小提琴
css 的CSS
.container{
width: 200px;
}
.blue-box{
width: 100px;
height: 100px;
background-color: blue;
margin: 0 auto;
margin-bottom: 20px;
}
hr.vertical{
display: inline;
float: left;
height: 330px;
position: absolute;
left: 100px;
border: 5px solid red;
top: 0;
}
html html
<div class="container">
<div class="blue-box"></div>
<div class="blue-box"></div>
<div class="blue-box"></div>
<hr class="vertical"/>
</div>
I didn't adjust the z-index so you could see how the <hr>
tag was positioned. 我没有调整z-index,因此您可以看到
<hr>
标签的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.