简体   繁体   English

CSS图像和标题没有换行

[英]CSS Image and caption no wrap

My goal is to generate this: 我的目标是生成此:

<div>
   Image (40px by 40px) Caption

   Image (40px by 40px) Caption

   Image (40px by 40px) Caption
</div>

My current code generates images that are wrapped up inside the div with previous list item instead of ones right below the image 我当前的代码生成的图像与上一个列表项一起被包裹在div中,而不是图像正下方的图像

my code structure is 我的代码结构是

<div>
   <ul>
      <li>
         <img/>
         <span>caption</span>
      </li>

      .....
   </ul>
</div>

What CSS do I need so I can avoid doing the wrap that I am seeing? 我需要什么CSS,这样我才能避免自己看到的包装?

the css i have righ now for these elements are 我现在对这些元素拥有的CSS是

li img{
    position:absolute;
    bottom:0;
    display: block;
}
li{
    position:relative;
}

.box (this is for div)
{
    padding: 4px 15px;
    border: 1px solid #ccc;
    margin: 0 0 10px 0;
    border-radius: 15px;
    -moz-border-radius: 15px;

} }

Not getting your question properly but if you want that the caption text doesn't get wrapper than use CSS white-space property so that the text doesn't get wrapped 不能正确得到你的问题,但如果你想要的字幕文本没有得到比包装使用CSS white-space属性,以使文字不会被包裹

.box /* (this is for div) */ {
    padding: 4px 15px;
    border: 1px solid #ccc;
    margin: 0 0 10px 0;
    border-radius: 15px;
    -moz-border-radius: 15px;
    white-space: nowrap;
}

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

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