如何在其他元素 HTML 上显示 <section> 标签

How to show <section> tag on other elements HTML

我有一个 div 内容部分 .white-back 是一个滑块。

我想在两个标签上显示。

我尝试使用:

.white-back{
  display: flex;
  object-fit: center;
  align-items: center;
}

但是屏幕上没有显示。

它应该看起来像:

屏幕中央的滑块.white-backdiv.formdiv.invite 是滑块的背景。

在这里查看我的代码:

$(".close, .nope").on('click', function () {
  $('.modal').addClass('hidden');
  $('.open').addClass('active');
})

$(".open").on('click', function () {
  $(this).removeClass('active');
  $('.modal').removeClass('hidden');
})

$('.quotes').slick({
  dots: true,
  infinite: true,
  autoplay: true,
  autoplaySpeed: 6000,
  speed: 800,
  slidesToShow: 1,
  adaptiveHeight: true
});

$( document ).ready(function() {
 $('.no-fouc').removeClass('no-fouc');
});
*, :before, :after {
  box-sizing: border-box;
  margin: 0;
  -webkit-transition: 0.4s;
    transition: 0.4s;
}

body {
  overflow: hidden;
}

.popup {
  color: #FFF;
  font-family: Roboto;
}

.modal {
  height: 450px;
  width: 650px;
  margin: auto;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  -webkit-transition: .4s, box-shadow .3s .4s;
          transition: .4s, box-shadow .3s .4s;
}
.modal.hidden {
  box-shadow: none;
  -webkit-transition: .4s, box-shadow 0s;
          transition: .4s, box-shadow 0s;
  opacity: 0;
  filter: alpha(opacity=0);
  visibility: hidden;
}
.modal.hidden .form {
  top: 100%;
}
.modal.hidden .invite {
  top: -100%;
}
.modal.hidden .invite .close {
  height: 0;
  width: 0;
  top: 0;
  right: 0;
}

.wrap-parent {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: -webkit-flex; 
  display: -ms-flexbox;
  display: flex; 
  -webkit-flex-direction: column; 
  -ms-flex-direction: column;
  flex-direction: column; 
}


input {
  background: rgba(255, 255, 255, 0.15);
  width: 100%;
  padding: 8px;
  margin: 15px 0;
  border: none;
  border-radius: 3px;
  outline: none;
  color: #FFF;
  font-size: 20px;
}
input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0px 500px #7a7a7a inset;
  -webkit-text-fill-color: #FFF;
}

label {
  font: 500 14px Roboto;
  color: #ffb66e;
}

button {
  background: -webkit-linear-gradient(135deg, #f04527, #ffb66e);
  background: linear-gradient(-45deg, #f04527, #ffb66e);
  padding: 10px 20px;
  border: none;
  border-radius: 21px;
  outline: none;
  overflow: hidden;
  position: absolute;
  bottom: 30px;
  left: 50%;
  color: #FFF;
  font-size: 18px;
  cursor: pointer;
  -webkit-transform: translateX(-50%);
      -ms-transform: translateX(-50%);
          transform: translateX(-50%);
}
button:hover:before {
  left: 110%;
  -webkit-transition: .3s;
          transition: .3s;
}
button:before {
  content: '';
  background: rgba(255, 255, 255, 0.3);
  height: 100%;
  width: 65px;
  position: absolute;
  top: 0;
  left: -100%;
  -webkit-transform: skew(-45deg);
      -ms-transform: skew(-45deg);
          transform: skew(-45deg);
  -webkit-transition: 0s;
          transition: 0s;
}

h2 {
  font: 30px Roboto;
  text-transform: uppercase;
}

.close {
  background: #474747;
  height: 30px;
  width: 30px;
  border: 3px solid #FFF;
  border-radius: 50%;
  position: absolute;
  top: -15px;
  right: -15px;
  cursor: pointer;
  -webkit-transition: .4s .3s;
          transition: .4s .3s;
}
.close:before, .close:after {
  content: '';
  background: #FFF;
  height: 80%;
  width: 3px;
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%) rotate(-45deg);
      -ms-transform: translate(-50%, -50%) rotate(-45deg);
          transform: translate(-50%, -50%) rotate(-45deg);
}
.close:after {
  -webkit-transform: translate(-50%, -50%) rotate(45deg);
      -ms-transform: translate(-50%, -50%) rotate(45deg);
          transform: translate(-50%, -50%) rotate(45deg);
}

.open {
  color: black;
  height: 45px;
  width: 150px;
  padding: 10px 20px;
  margin: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  filter: alpha(opacity=0);
  visibility: hidden;
}
.open.active {
  opacity: 1;
  filter: alpha(opacity=100);
  visibility: visible;
}
.form {
  background: red;
  padding: 440px 0;
  -webkit-transform: skew(0deg, -20deg);
  transform: skew(0deg, -20deg);
  margin-top: -250px;
  padding-top: 140px !important;
}
.invite {
  background: black;
  padding-top: 300px;
  transform: skew(0deg, -20deg);
  padding-bottom: 280px;
}

/*.form form {
  -webkit-transform: skew(0deg, 20deg);
  transform: skew(0deg, 20deg);
  text-align: center;
}

.invite .content {
  -webkit-transform: skew(0deg, 20deg);
  transform: skew(0deg, 20deg);
  text-align: center;
}*/

/* Simple Slider */
.white-back{
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  background: #fff;
  display: flex;
  object-fit: center;
  align-items: center;
}
.simple blockquote p {
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  color: #1e528e;
  padding: 25px;
  font-size: 1.25em;
  font-style: italic;
  text-align: center;
}
.simple cite {
  font-size: 1em;
  float: right;
  font-style: normal;
  color: #1e528e;
}
.simple cite a {
  color: #2d91c2;
  font-style: italic;
  text-decoration: none;
  font-size:.85em;
}
.simple cite a:hover {
  color: #00B4CC;
}
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Daily UI #001 - Sign Up Modal</title>
    
    <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css"/>
    <!-- Add the slick-theme.css if you want default styling -->
    <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick-theme.css"/>
    <link href="http://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" type="text/css">

</head>

<body>
    <div class="popup">
        <a class="open active" title="open modal" href="#">Open Modal</a>

        <div class="modal hidden wrap-parent">
            <div class="form">
            </div>
            <div class="invite">
            </div>
            <!-- Simplest Slider -->

            <section role="complementary" class="simple white-back quotes no-fouc">
              <blockquote>
                <p><strong>to cite (verb)</strong>: to acknowledge (give credit to) the original author or artist by providing a reference.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
              <blockquote>
                <p><strong>citation (noun)</strong>: a properly formatted line of text that indicates the source for a quote, idea, fact etc. that you use.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
              <blockquote>
                <p>If you are repeating a section of the article for emphasis, use an aside element.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
              <blockquote>
                <p> A blockquote element cannot be inside a paragraph, and since HTML4 actually needs to contain paragraphs.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
              <blockquote>
                <p><strong>to cite (verb)</strong>: to acknowledge (give credit to) the original author or artist by providing a reference.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
              <blockquote>
                <p><strong>citation (noun)</strong>: a properly formatted line of text that indicates the source for a quote, idea, fact etc. that you use.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
              <blockquote>
                <p>If you are repeating a section of the article for emphasis, use an aside element.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
              <blockquote>
                <p> A blockquote element cannot be inside a paragraph, and since HTML4 actually needs to contain paragraphs.</p>
                <cite>Someone Said<br />
                <a href="#">Said it Here</a></cite> </blockquote>
            </section>
        </div>

    </div>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js"></script>
</body>

</html>

请点击full screen按钮显示我的完整示例。

或者 JsFiddle:https://jsfiddle.net/gyzsaueg/2/

position:absolute; 添加到您的 css 以获得简单的 header

.white-back{
  position: absolute;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  background: #fff;
  display: flex;
  object-fit: center;
  align-items: center;
}

之后您将需要调整高度和宽度。 希望这有帮助。