【问题标题】:How to align images and button in a collection of divs? [duplicate]如何对齐 div 集合中的图像和按钮? [复制]
【发布时间】:2020-11-08 12:38:46
【问题描述】:

我对 CSS 很不满意。我正在尝试解决图像中捕获的问题。我的容器中的一个部分的文本量略少,导致在较小的设备上查看页面时看起来没有对齐。我正在努力让事情排列得更整齐,但我不知道如何做。

这是 Jade 中的代码:

extends base
block content
  #marketing.container
    .row
      .3u
        section
          header
            h2.titlething Sales & Marketing
          p.subtitle
            | In posuere eleifend odio. Quisque semper augue mattis maecenas
            | ligula.
          p
            a(href='#')
              img(src='images/pics13.jpg', alt='')
          a.button(href='#') View Jobs

还有一些 CSS:

.titlething {
  margin-top: 1em;
  margin-bottom: 0.2em;
}

/* Buttons */

.button {
  position: relative;
  display: inline-block;
  margin-top: 0.5em;
  padding: 0.5em 1.5em;
  background: #e95d3c;
  border-radius: 6px;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 1.1em;
  color: #fff;
  -moz-transition: color 0.35s ease-in-out, background-color 0.35s ease-in-out;
  -webkit-transition: color 0.35s ease-in-out,
    background-color 0.35s ease-in-out;
  -o-transition: color 0.35s ease-in-out, background-color 0.35s ease-in-out;
  -ms-transition: color 0.35s ease-in-out, background-color 0.35s ease-in-out;
  transition: color 0.35s ease-in-out, background-color 0.35s ease-in-out;
  cursor: pointer;
}

.button:hover {
  background: #de3d27;
  color: #fff !important;
}

#marketing {
  position: relative;
  justify-content: space-between;
}

#marketing header h2 {
  font-size: 1.6em;
}

【问题讨论】:

    标签: html css responsive-design pug


    【解决方案1】:

    可能最简单的解决方案是使标题高度始终相同。所以我的建议:

    .titlething {
      margin-top: 1em;
      margin-bottom: 0.2em;
    height: 4em;
    }
    

    当然你需要调整高度参数以适应你的布局。

    【讨论】:

      猜你喜欢
      • 2012-11-09
      • 1970-01-01
      • 1970-01-01
      • 2016-11-08
      • 2021-02-24
      • 2014-03-20
      • 1970-01-01
      • 1970-01-01
      • 2016-05-22
      相关资源
      最近更新 更多