以html为中心的“卡片”问题

时间:2017-03-10 10:11:20

标签: html

亲爱的Stackoverflow社区,

我想将三张卡片放在大图像下的第二行中心。我还可以帮助消除第二排和第三排之间的差距吗? 我试图使用文本对齐来居中,但只有文本对齐。

非常感谢

h1{
  padding-left:50px;
  font-weight: bold;
  color: white;

}

/* Add a black background color to the top navigation */
.topnav {
    background-color: white;
    overflow: hidden;
    border: 2px solid;

    
}

/* Style the links inside the navigation bar */
.topnav a {
    float: left;
    display: black;
    color: black;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
    font-family: 'Open Sans', sans-serif;
}

/* Change the color of links on hover */
.topnav a:hover {
    background-color: #ddd;
    color: black;
}

/* Add a color to the active/current link */
.topnav a.active {
    background-color: #4CAF50;
    color: white;
}


@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
* {
  box-sizing: border-box;
}

body {
  background-image: linear-gradient(to right, #034378, #2d4e68);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  font-family: "Open Sans", sans-serif;
}

a {
  text-decoration: none;
}

h1 {
  font-family: "Open Sans", sans-serif;
  font-weight: 300;
}

.row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.main_row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.third_row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.card {
  padding: 0 1.7rem;
  width: 100%;
}

.card2 {
  float: left;
  padding: 0 1.7rem;
  width: 50%;
}

.card .menu-content {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.card .menu-content::before,
.card .menu-content::after {
  content: '';
  display: table;
}

.card .menu-content::after {
  clear: both;
}

.card .menu-content li {
  display: inline-block;
}

.card .menu-content a {
  color: #fff;
}

.card .menu-content span {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Open Sans';
  transform: translate(-50%, 0);
}

.card .wrapper {
  background-color: #fff;
  min-height: 540px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}

.card .wrapper:hover .data {
  transform: translateY(0);
}

.card .data {
  position: absolute;
  bottom: 0;
  width: 100%;
  transform: translateY(calc(70px + 1em));
  transition: transform 0.3s;
}

.card .data .content {
  padding: 1em;
  position: relative;
  z-index: 1;
}

.card .author {
  font-size: 12px;
}

.card .title {
  margin-top: 10px;
}

.card .text {
  height: 70px;
  margin: 0;
}

.card input[type='checkbox'] {
  display: none;
}

.card input[type='checkbox']:checked + .menu-content {
  transform: translateY(-60px);
}

.example-2 .wrapper {
  background: url(https://theluxurytravelexpert.files.wordpress.com/2014/01/scenery.jpg) center/cover no-repeat;
}

.example-2 .wrapper:hover .menu-content span {
  transform: translate(-50%, -10px);
  opacity: 1;
}

.example-2 .header {
  color: #fff;
  padding: 1em;
}

.example-2 .header::before,
.example-2 .header::after {
  content: '';
  display: table;
}

.example-2 .header::after {
  clear: both;
}

.example-2 .header .date {
  float: left;
  font-size: 12px;
}

.example-2 .menu-content {
  float: right;
}

.example-2 .menu-content li {
  margin: 0 5px;
  position: relative;
}

.example-2 .menu-content span {
  transition: all 0.3s;
  opacity: 0;
}

.example-2 .data {
  color: #fff;
  transform: translateY(calc(70px + 4em));
}

.example-2 .title a {
  color: #fff;
}

.example-2 .button {
  display: block;
  width: 100px;
  margin: 2em auto 1em;
  text-align: center;
  font-size: 12px;
  color: #fff;
  line-height: 1;
  position: relative;
  font-weight: 700;
}

.example-2 .button::after {
  content: '\2192';
  opacity: 0;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(0, -50%);
  transition: all 0.3s;
}

.example-2 .button:hover::after {
  transform: translate(5px,-50%);
  opacity: 1;
}




.card_main_article {
  text-align: left;
  height: 100%;
  width: 30%;
  display: inline-block;

}

.card_sub_article {
  text-align: right;
  height: 100%;
  width: 30%;
  display: inline-block;
}

.card_main {
  text-align: left;
  display: block;
  padding: 0 1.7rem;
  width: 100%;
}




.card_main .menu-content {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.card_main .menu-content::before,
.card .menu-content::after {
  content: '';
  display: table;
}

.card_main .menu-content::after {
  clear: both;
}

.card_main .menu-content li {
  display: inline-block;
}

.card_main .menu-content a {
  color: #fff;
}

.card_main .menu-content span {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Open Sans';
  transform: translate(-50%, 0);
}

.card_main .wrapper {
  background-color: #fff;
  min-height: 540px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}

.card_main .wrapper:hover .data {
  transform: translateY(0);
}

.card_main .data {
  position: absolute;
  bottom: 0;
  width: 100%;
  transform: translateY(calc(70px + 1em));
  transition: transform 0.3s;
}

.card_main .data .content {
  padding: 1em;
  position: relative;
  z-index: 1;
}

.card_main .author {
  font-size: 12px;
}

.card_main .title {
  margin-top: 10px;
}

.card_main .text {
  height: 70px;
  margin: 0;
}

.card_main input[type='checkbox'] {
  display: none;
}

.card_main input[type='checkbox']:checked + .menu-content {
  transform: translateY(-60px);
}
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>


<div class="topnav" id="myTopnav">
  <a href="#home">Home</a>
  <a href="#news">News</a>
  <a href="#contact">Contact</a>
  <a href="#about">About</a>
  <a href="file:///Users/TDE/Desktop/test/login.html">Login</a>

</div>


<div class="main_row">
  <div class="example-2 card">
    <div class="wrapper">
      <div class="header">
        <div class="date">
          <span class="day">12</span>
          <span class="month">Aug</span>
          <span class="year">2016</span>
        </div>
        <ul class="menu-content">
          <li>
            <a href="#" class="fa fa-bookmark-o"></a>
          </li>
          <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
          <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
        </ul>
      </div>
      <div class="data">
        <div class="content">
          <span class="author">REVIEW</span>
          <h1 class="title"><a href="#">TITLE</a></h1>
          <p class="text">Description</p>
          <a href="#" class="button">Read more</a>
        </div>
      </div>
    </div>
  </div>
</div>


<div class="row">
    <h1>Articles:</h1>
  <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
  </div>



  <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="third_row">
      <h1>Article 2:</h1>
    <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
    </div>
  </div>



 

</div>

2 个答案:

答案 0 :(得分:0)

创建一个名为.row-center的新类,并将其添加到您想要居中的行中。

在CSS中添加:

.row-center {
  text-align: center;
}

至于你的第二个问题,我不确定你在行之间有什么差距。

h1{
  padding-left:50px;
  font-weight: bold;
  color: white;

}

/* Add a black background color to the top navigation */
.topnav {
    background-color: white;
    overflow: hidden;
    border: 2px solid;

    
}

/* Style the links inside the navigation bar */
.topnav a {
    float: left;
    display: black;
    color: black;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
    font-family: 'Open Sans', sans-serif;
}

/* Change the color of links on hover */
.topnav a:hover {
    background-color: #ddd;
    color: black;
}

/* Add a color to the active/current link */
.topnav a.active {
    background-color: #4CAF50;
    color: white;
}


@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
* {
  box-sizing: border-box;
}

body {
  background-image: linear-gradient(to right, #034378, #2d4e68);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  font-family: "Open Sans", sans-serif;
}

a {
  text-decoration: none;
}

h1 {
  font-family: "Open Sans", sans-serif;
  font-weight: 300;
}

.row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.row-center {
 text-align: center;
}

.main_row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.third_row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.card {
  padding: 0 1.7rem;
  width: 100%;
}

.card2 {
  float: left;
  padding: 0 1.7rem;
  width: 50%;
}

.card .menu-content {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.card .menu-content::before,
.card .menu-content::after {
  content: '';
  display: table;
}

.card .menu-content::after {
  clear: both;
}

.card .menu-content li {
  display: inline-block;
}

.card .menu-content a {
  color: #fff;
}

.card .menu-content span {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Open Sans';
  transform: translate(-50%, 0);
}

.card .wrapper {
  background-color: #fff;
  min-height: 540px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}

.card .wrapper:hover .data {
  transform: translateY(0);
}

.card .data {
  position: absolute;
  bottom: 0;
  width: 100%;
  transform: translateY(calc(70px + 1em));
  transition: transform 0.3s;
}

.card .data .content {
  padding: 1em;
  position: relative;
  z-index: 1;
}

.card .author {
  font-size: 12px;
}

.card .title {
  margin-top: 10px;
}

.card .text {
  height: 70px;
  margin: 0;
}

.card input[type='checkbox'] {
  display: none;
}

.card input[type='checkbox']:checked + .menu-content {
  transform: translateY(-60px);
}

.example-2 .wrapper {
  background: url(https://theluxurytravelexpert.files.wordpress.com/2014/01/scenery.jpg) center/cover no-repeat;
}

.example-2 .wrapper:hover .menu-content span {
  transform: translate(-50%, -10px);
  opacity: 1;
}

.example-2 .header {
  color: #fff;
  padding: 1em;
}

.example-2 .header::before,
.example-2 .header::after {
  content: '';
  display: table;
}

.example-2 .header::after {
  clear: both;
}

.example-2 .header .date {
  float: left;
  font-size: 12px;
}

.example-2 .menu-content {
  float: right;
}

.example-2 .menu-content li {
  margin: 0 5px;
  position: relative;
}

.example-2 .menu-content span {
  transition: all 0.3s;
  opacity: 0;
}

.example-2 .data {
  color: #fff;
  transform: translateY(calc(70px + 4em));
}

.example-2 .title a {
  color: #fff;
}

.example-2 .button {
  display: block;
  width: 100px;
  margin: 2em auto 1em;
  text-align: center;
  font-size: 12px;
  color: #fff;
  line-height: 1;
  position: relative;
  font-weight: 700;
}

.example-2 .button::after {
  content: '\2192';
  opacity: 0;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(0, -50%);
  transition: all 0.3s;
}

.example-2 .button:hover::after {
  transform: translate(5px,-50%);
  opacity: 1;
}




.card_main_article {
  text-align: left;
  height: 100%;
  width: 30%;
  display: inline-block;

}

.card_sub_article {
  text-align: right;
  height: 100%;
  width: 30%;
  display: inline-block;
}

.card_main {
  text-align: left;
  display: block;
  padding: 0 1.7rem;
  width: 100%;
}




.card_main .menu-content {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.card_main .menu-content::before,
.card .menu-content::after {
  content: '';
  display: table;
}

.card_main .menu-content::after {
  clear: both;
}

.card_main .menu-content li {
  display: inline-block;
}

.card_main .menu-content a {
  color: #fff;
}

.card_main .menu-content span {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Open Sans';
  transform: translate(-50%, 0);
}

.card_main .wrapper {
  background-color: #fff;
  min-height: 540px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}

.card_main .wrapper:hover .data {
  transform: translateY(0);
}

.card_main .data {
  position: absolute;
  bottom: 0;
  width: 100%;
  transform: translateY(calc(70px + 1em));
  transition: transform 0.3s;
}

.card_main .data .content {
  padding: 1em;
  position: relative;
  z-index: 1;
}

.card_main .author {
  font-size: 12px;
}

.card_main .title {
  margin-top: 10px;
}

.card_main .text {
  height: 70px;
  margin: 0;
}

.card_main input[type='checkbox'] {
  display: none;
}

.card_main input[type='checkbox']:checked + .menu-content {
  transform: translateY(-60px);
}
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>


<div class="topnav" id="myTopnav">
  <a href="#home">Home</a>
  <a href="#news">News</a>
  <a href="#contact">Contact</a>
  <a href="#about">About</a>
  <a href="file:///Users/TDE/Desktop/test/login.html">Login</a>

</div>


<div class="main_row">
  <div class="example-2 card">
    <div class="wrapper">
      <div class="header">
        <div class="date">
          <span class="day">12</span>
          <span class="month">Aug</span>
          <span class="year">2016</span>
        </div>
        <ul class="menu-content">
          <li>
            <a href="#" class="fa fa-bookmark-o"></a>
          </li>
          <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
          <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
        </ul>
      </div>
      <div class="data">
        <div class="content">
          <span class="author">REVIEW</span>
          <h1 class="title"><a href="#">TITLE</a></h1>
          <p class="text">Description</p>
          <a href="#" class="button">Read more</a>
        </div>
      </div>
    </div>
  </div>
</div>


<div class="row row-center">
    <h1>Articles:</h1>
  <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
  </div>



  <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="third_row">
      <h1>Article 2:</h1>
    <div class="card_sub_article">
    <div class="example-2 card_main">
      <div class="wrapper">
        <div class="header">
          <div class="date">
            <span class="day">12</span>
            <span class="month">Aug</span>
            <span class="year">2016</span>
          </div>
          <ul class="menu-content">
            <li>
              <a href="#" class="fa fa-bookmark-o"></a>
            </li>
            <li><a href="#" class="fa fa-heart-o"><span>18</span></a></li>
            <li><a href="#" class="fa fa-comment-o"><span>3</span></a></li>
          </ul>
        </div>
        <div class="data">
          <div class="content">
            <span class="author">REVIEW</span>
            <h1 class="title"><a href="#">TITLE</a></h1>
            <p class="text">Description</p>
            <a href="#" class="button">Read more</a>
          </div>
        </div>
      </div>
    </div>
    </div>
  </div>



 

</div>

答案 1 :(得分:0)

&#13;
&#13;
source
&#13;
h1{
  padding-left:50px;
  font-weight: bold;
  color: white;

}

/* Add a black background color to the top navigation */
.topnav {
    background-color: white;
    overflow: hidden;
    border: 2px solid;

    
}

/* Style the links inside the navigation bar */
.topnav a {
    float: left;
    display: black;
    color: black;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
    font-family: 'Open Sans', sans-serif;
}

/* Change the color of links on hover */
.topnav a:hover {
    background-color: #ddd;
    color: black;
}

/* Add a color to the active/current link */
.topnav a.active {
    background-color: #4CAF50;
    color: white;
}


@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
* {
  box-sizing: border-box;
}

body {
  background-image: linear-gradient(to right, #034378, #2d4e68);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  font-family: "Open Sans", sans-serif;
}

a {
  text-decoration: none;
}

h1 {
  font-family: "Open Sans", sans-serif;
  font-weight: 300;
}

.row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.main_row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.third_row {
  max-width: 4900px;
  margin: 50px auto 0;
}

.card {
  padding: 0 1.7rem;
  width: 100%;
}

.card2 {
  float: left;
  padding: 0 1.7rem;
  width: 50%;
}

.card .menu-content {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.card .menu-content::before,
.card .menu-content::after {
  content: '';
  display: table;
}

.card .menu-content::after {
  clear: both;
}

.card .menu-content li {
  display: inline-block;
}

.card .menu-content a {
  color: #fff;
}

.card .menu-content span {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Open Sans';
  transform: translate(-50%, 0);
}

.card .wrapper {
  background-color: #fff;
  min-height: 540px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}

.card .wrapper:hover .data {
  transform: translateY(0);
}

.card .data {
  position: absolute;
  bottom: 0;
  width: 100%;
  transform: translateY(calc(70px + 1em));
  transition: transform 0.3s;
}

.card .data .content {
  padding: 1em;
  position: relative;
  z-index: 1;
}

.card .author {
  font-size: 12px;
}

.card .title {
  margin-top: 10px;
}

.card .text {
  height: 70px;
  margin: 0;
}

.card input[type='checkbox'] {
  display: none;
}

.card input[type='checkbox']:checked + .menu-content {
  transform: translateY(-60px);
}

.example-2 .wrapper {
  background: url(https://theluxurytravelexpert.files.wordpress.com/2014/01/scenery.jpg) center/cover no-repeat;
}

.example-2 .wrapper:hover .menu-content span {
  transform: translate(-50%, -10px);
  opacity: 1;
}

.example-2 .header {
  color: #fff;
  padding: 1em;
}

.example-2 .header::before,
.example-2 .header::after {
  content: '';
  display: table;
}

.example-2 .header::after {
  clear: both;
}

.example-2 .header .date {
  float: left;
  font-size: 12px;
}

.example-2 .menu-content {
  float: right;
}

.example-2 .menu-content li {
  margin: 0 5px;
  position: relative;
}

.example-2 .menu-content span {
  transition: all 0.3s;
  opacity: 0;
}

.example-2 .data {
  color: #fff;
  transform: translateY(calc(70px + 4em));
}

.example-2 .title a {
  color: #fff;
}

.example-2 .button {
  display: block;
  width: 100px;
  margin: 2em auto 1em;
  text-align: center;
  font-size: 12px;
  color: #fff;
  line-height: 1;
  position: relative;
  font-weight: 700;
}

.example-2 .button::after {
  content: '\2192';
  opacity: 0;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(0, -50%);
  transition: all 0.3s;
}

.example-2 .button:hover::after {
  transform: translate(5px,-50%);
  opacity: 1;
}




.card_main_article {
  text-align: left;
  height: 100%;
  width: 30%;
  display: inline-block;

}

.card_sub_article {
  text-align: right;
  height: 100%;
  width: 30%;
  display: inline-block;
}

.card_main {
  text-align: left;
  display: block;
  padding: 0 1.7rem;
  width: 100%;
}




.card_main .menu-content {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.card_main .menu-content::before,
.card .menu-content::after {
  content: '';
  display: table;
}

.card_main .menu-content::after {
  clear: both;
}

.card_main .menu-content li {
  display: inline-block;
}

.card_main .menu-content a {
  color: #fff;
}

.card_main .menu-content span {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Open Sans';
  transform: translate(-50%, 0);
}

.card_main .wrapper {
  background-color: #fff;
  min-height: 540px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}

.card_main .wrapper:hover .data {
  transform: translateY(0);
}

.card_main .data {
  position: absolute;
  bottom: 0;
  width: 100%;
  transform: translateY(calc(70px + 1em));
  transition: transform 0.3s;
}

.card_main .data .content {
  padding: 1em;
  position: relative;
  z-index: 1;
}

.card_main .author {
  font-size: 12px;
}

.card_main .title {
  margin-top: 10px;
}

.card_main .text {
  height: 70px;
  margin: 0;
}

.card_main input[type='checkbox'] {
  display: none;
}

.card_main input[type='checkbox']:checked + .menu-content {
  transform: translateY(-60px);
}
&#13;
&#13;
&#13;