html - 如何阻止 Images of Pure Grid Div 下的文本被压扁

标签 html css yui-pure-css

我正在使用 CSS 纯网格类制作图像网格,并在每个图像下方放置一个文本标签。然而,这是行不通的,因为文本被压扁了(见下图):

enter image description here

这是我的代码:

  <div class="pure-g" style="margin-top:90px; margin-left:200px">

      <div class="pure-u-lg-1-4 pure-u-md-1-2 pure-u-sm-1" style="margin-right:50px">
          <a href="#" class="thumbnail">
            <img src="sample_image.jpg" width=200px>
            <center>
              <span class="caption" style="color:black" > <br> My Text Under Image</span>
          </center>
        <br>
      </div>

最佳答案

您是否为 pure responsive grids 添加了必要的 CSS 文件? ?

在您的代码中,adiv 标记缺少结尾。关闭这些标签后一切正常:

<link href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" rel="stylesheet"/>
<link href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-min.css" rel="stylesheet"/>

<div class="pure-g" style="margin-top:90px; margin-left:200px">
  <div class="pure-u-lg-1-4 pure-u-md-1-2 pure-u-sm-1" style="margin-right:50px">
    <a href="#" class="thumbnail">
            <img src="sample_image.jpg" width=200px>
            <center>
              <span class="caption" style="color:black" > <br> My Text Under Image</span>
          </center>
        <br>
        </a>
  </div>
</div>

关于html - 如何阻止 Images of Pure Grid Div 下的文本被压扁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50651172/

相关文章:

javascript - 当图像在同一行时 commandLink 不工作

html - 如何在 Flex 容器中定位 –THIS–?

html - Pure.css 1-3 网格每行只显示 2 个元素

html - 垂直对齐标签

html - 如何正确 float 列表

html - 在 div 中跨度类以分隔 2 个单词 html

javascript - 我如何更改 <h :selectOneMenu> Dropdown menu on selecting an entry in JSF? 的颜色

javascript - 我的网站上有两个 Google 广告,第一个广告仅在第二个广告出现时才会显示

jquery - div 在每次回发和页面刷新后出现

html - 创建一个比其他子菜单大的子菜单以包含表格