简体   繁体   English

延伸图像高度

[英]extending image height

I have an image defined as 我将图像定义为

 <td>
 <p>Text for para</p>
<img src="vertical_divider.png" align="right" style="padding: 15px; height: 100%;">
</td>

The image is a vertical divider which acts like a right boundary to the paragraph whose contents are editable , so it keeps changing in height. 图像是一个垂直分隔符,其作用类似于内容可编辑的段落的右边界,因此它的高度不断变化。

How do I make sure that the vertical divider also keeps changing in height according to the entire paragraph. 如何确保垂直分隔线根据整个段落的高度不断变化。

Try set the image as background with repeat-y 尝试使用repeat-y将图像设置为背景

td
{
    background-image:url(vertical_divider.png);
    background-repeat:repeat-y;
    background-position:right top;
}

Using css you can set it to a background image that will extend in the space. 使用css,您可以将其设置为将在空间中扩展的背景图像。 Or if you simply want a line you can do it without the image. 或者,如果您只是想要一条线,您可以在没有图像的情况下进行。

<td style="border-right: 1px solid black;">
 <p>Text for para</p>
</td>

May this divider work better as background paragraph. 愿这个分隔符作为背景段更好地工作。

<td>
  <p style="padding-right:15px;background:url("vertical_divider.png") repeat-y top right;outline:1px solid red;">
   Text for <br>para
  </p>
</td>

But if you need to this divider keep in a image tag to be clickable or whatever. 但是,如果您需要将此分隔符保留在图像标记中以便可点击或其他任何内容。 You can use the float property(less compatible). 您可以使用float属性(兼容性较差)。

<td style="outline:1px solid red;">
  <img src="vertical_divider.png" style="display:block;float:right; height: 100%;">
  <p>Text for para</p>
</td>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM