2017-06-14 14 views
1

私のビューには2つのセクションがあります。ここで1つのdivを持つ2つのdiv(ASP.NETコア)

は、ビューのコードです:

<section id="about" class="container content-section text-center"> 
 
    <div class="row"> 
 
     <div class="col-lg-8 col-lg-offset-2"> 
 
      <h2>About Grayscale</h2> 
 
      <p> 
 
       
 
      </p> 
 
      <p> 
 
       
 
      </p> 
 
      <p>Н</p> 
 
     </div> 
 
     
 
</section> 
 
<!-- Download Section --> 
 
<section id="download" class="content-section text-center"> 
 
    <div class="download-section"> 
 
     <div class="container"> 
 
      <div> 
 
       <h2 style="text-align: center;">Программа обучения VR</h2> 
 
       <div style="width:30%;height:530px;float:left;border-style:solid;border-width:15px;border-color:#42DCA3"> 
 
        <p style="padding-top:10px;font-size:30px;"><b>VR</b></p> 
 
        <p style="color:#FFD700;font-size:35px;"><b><strike>3600 грн </strike></b></p> 
 
        <p style="color:black;font-size:28px;"><b>2600 грн до 24.06.17 </b></p> 
 
        <div style="border-bottom: 1px solid #42DCA3;border-top: 1px solid #42DCA3;padding: 20px 0;margin-bottom: 20px;font-size:20px;"> 
 
         6 недель, 12 занятий,36 часов<br> 
 
         + практика с HTC Vive<br> 
 
         + создание 3D объектов<br> 
 
         + создание ролика с камерой 360° 
 
        </div> 
 
        <div style="font-size:20px;">Старт 01.07.17</div> 
 
        <div style="margin: 0 auto;padding-top:20px;"> 
 
       <button class="btn btn-default btn-lg" data-toggle="modal" data-target="#myModal">Оставить заявку</button> 
 
       </div> 
 
       </div> 
 
       
 
      </div> 
 
      
 
     </div> 
 
    </div>

Here is all code with css私はデザインで、ここのように、この2つのdivを重ねてブロックを作成する必要があり

enter image description here

どうすればいいですか?

ありがとうございました。

答えて

1

価格ブロックを左側に適切に配置するには、最初の要素にする必要があります(下のスニペットを参照)。 イメージとダークカラーをDIVの背景として使用することで、実際のオーバーレイが不要なため、オーバーレイすることによって何を意味するのか分かりません。

divをオーバーレイする必要がある場合は、position absoluteを使用してフレックスボックスを使用できます。これはあなたが探しているものであれば

<section id="about" class="container content-section text-center"> 
 
    <div class="row"> 
 
     <div class="col-lg-8 col-lg-offset-2"> 
 
      <h2>About Grayscale</h2> 
 
      <p> 
 
       
 
      </p> 
 
      <p> 
 
       
 
      </p> 
 
      <p>Н</p> 
 
     </div> 
 
     
 
</section> 
 
<!-- Download Section --> 
 
<section id="download" class="content-section text-center"> 
 
    <div class="download-section"> 
 
     <div class="container"> 
 
      <div> 
 
       
 
       <div style="width:30%;height:530px;float:left;border-style:solid;border-width:15px;border-color:#42DCA3; margin-right: 20px"> 
 
        <p style="padding-top:10px;font-size:30px;"><b>VR</b></p> 
 
        <p style="color:#FFD700;font-size:35px;"><b><strike>3600 грн </strike></b></p> 
 
        <p style="color:black;font-size:28px;"><b>2600 грн до 24.06.17 </b></p> 
 
        <div style="border-bottom: 1px solid #42DCA3;border-top: 1px solid #42DCA3;padding: 20px 0;margin-bottom: 20px;font-size:20px;"> 
 
         6 недель, 12 занятий,36 часов<br> 
 
         + практика с HTC Vive<br> 
 
         + создание 3D объектов<br> 
 
         + создание ролика с камерой 360° 
 
        </div> 
 
        <div style="font-size:20px;">Старт 01.07.17</div> 
 
        <div style="margin: 0 auto;padding-top:20px;"> 
 
       <button class="btn btn-default btn-lg" data-toggle="modal" data-target="#myModal">Оставить заявку</button> 
 
       </div> 
 
       </div> 
 
       <h2 style="text-align: center; padding-top: 100px;">Программа обучения VR</h2> 
 
<div style="padding: 10px;">01</br>02</br>03</br>04</br>05</br></div> 
 
      </div> 
 
      
 
     </div> 
 
    </div>

追加ここで

は、絶対位置と簡単なコードスニペットです。

.top-div { 
 
    width: 400px; 
 
    height: 200px; 
 
    background: url('https://photos.smugmug.com/Stock-images/Westward-Expansion-Photos/gettysburg-battlefield-photos/i-S8rSqgg/1/70e2c6c8/S/Gettysburg%20Battlefield%20Photos-S.jpg'); 
 
} 
 
.bottom-div { 
 
    width: 400px; 
 
    height: 400px; 
 
    background: Orange; 
 
    box-sizing: border-box; 
 
    padding: 10px 10px 10px 200px; 
 
} 
 
.overlay-holder { 
 
    position: relative; 
 
} 
 
.overlay { 
 
    position: absolute; 
 
    top: 100px; 
 
    left: 10px; 
 
    width: 180px; 
 
    background: LightBlue; 
 
    box-sizing: border-box; 
 
    padding: 10px; 
 
}
<div class="overlay-holder"> 
 
    <div class="overlay"> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    This text is in the overlay<br/> 
 
    </div> 
 
</div> 
 
<div class="top-div"></div> 
 
<div class="bottom-div"> 
 
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 
 
</div>

+0

あなたが設計からわかるように、私はソリッドカラーとそれら二つのdivの下に一つのブロックと画像とdiv要素でDIVています。 – Logan

+0

画像をdivにする必要はありません。ダウンロードセクションの背景画像にすることができます。 背景:url( 'path/to/your/image')#あなたのソリッドカラーno-repeat top center; –

関連する問題