html - 在 p 标签内具有最大宽度的 Img 不起作用

标签 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>

我不知道为什么 imgmax-width 不起作用。如果我删除 p 标签,它就可以工作。 无论如何要在 p 标签内使用 max_width

最佳答案

你不能在你的字体周​​围使用双引号 " 它会破坏 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%;">

关于html - 在 p 标签内具有最大宽度的 Img 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12419559/

相关文章:

html - 我无法在悬停时增加图像的Z索引

image - 滑动 Flutter 时应用彩色滤镜图片

php - 我如何将 Mysqli 表结果转换为带有下拉菜单的菜单

linux - 为 cutycapt 和 imagemagic 生成更多吞吐量以生成缩略图

html - .container > .wrapper > img : maximize img, 但不大于 .container(祖 parent ) - 怎么样?

javascript - 查找错误 : highlight side menu based on page scrolling position

html - 试图让颜色显示

javascript - 如何在 html cordova android 应用程序中创建 'add to favourite' 功能?

html - CSS 旋转箭头具有幻象高度

html - 使用 CSS 的响应式表格