Img内部最大宽度p标签不起作用

时间:2012-09-14 06:57:39

标签: html css image

我有一个HTML代码:

  <div style="width:100%;word-wrap:break-word;;" align="justify">
    <p style="text-align: justify;" align="justify">  
      <img class="news-image" alt=" Thời trang" 
           src="http://img-hcm.24hstatic.com/upload/3-2012/images/2012-09-13/1347508625-lan-khue1.jpg" 
           style="font-size: medium; font-family: "Times New Roman";max-width:95%;">
   </p>
  </div>

我不知道为什么max-width的{​​{1}}无效。如果我删除img标记,则可以。 无论如何在p标记内使用max_width

1 个答案:

答案 0 :(得分:2)

你不能在你的字体周​​围使用双"引号,它会破坏html使用单数'而不是

更改:

<img class="news-image" alt=" Thời trang" 
           src="http://img-hcm.24hstatic.com/upload/3-2012/images/2012-09-13/1347508625-lan-khue1.jpg" 
           style="font-size: medium; font-family: "Times New Roman";max-width:95%;">

<img class="news-image" alt=" Thời trang" 
           src="http://img-hcm.24hstatic.com/upload/3-2012/images/2012-09-13/1347508625-lan-khue1.jpg" 
           style="font-size: medium; font-family: 'Times New Roman';max-width:95%;">