亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何用 CSS 中的 div 標簽填充空間?(包括圖片)

如何用 CSS 中的 div 標簽填充空間?(包括圖片)

aluckdog 2023-10-24 20:01:00
我是一名新手,在自己學習 HTML 和 CSS 方面,并且一直在幾個視頻的指導下嘗試編碼。顯然,我必須通過這種方式來解決知識差距。不管怎樣,我已經從我的頭腦中“設計”了一個CSS布局,這樣可以幫助我在學習的過程中進一步推進。這是圖像,我希望它具有圖像布局代碼的輸出如下所示:結果我一直在試圖弄清楚如何在左側和右側的標題 div 下方對齊一個 div,以完全填充黑色空間。我的代碼如下:body {  font-family: Verdana, Arial, Helvetica, sans-serif;  color: blue;  margin: 0;  padding: 0;  width: 100%;  background-color: black;  background-size: cover;  background-repeat: no-repeat;}.Header {  height: 191px;  background: #808080;  border: 1px solid #000000;  text-align: center;  font-family: Arial, Helvetica, sans-serif;  font-size: 30px;}.contentwrap {  width: 1025px;  margin: 0 auto;}.container {  background: #808080;  border: 1px solid #000000;  height: 190px;}.footer {  background: #808080;  border: 1px solid #000000;  height: 129px;}<div class="Header">  <h1> Header </h1></div><div class="contentwrap">  <div class="container">    <p> Text </p>  </div>  <div class="container">    <p> Text </p>  </div>  <div class="container">    <p> text </p>  </div>  <div class="container">    <p> text </p>  </div>  <div class="footer">    <p> footer </p>  </div></div>
查看完整描述

2 回答

?
四季花海

TA貢獻1811條經驗 獲得超5個贊

body {

  font-family: Verdana, Arial, Helvetica, sans-serif;

  color: blue;

  margin: 0;

  padding: 0;

  background-color: black;

}


.Header {

  height: 191px;

  background: #808080;

  border: 1px solid #000000;

  text-align: center;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 30px;

}


.content {

  display: flex;

}


.content__sidebar {

  width: 200px;

  min-height: 100%;

}


.content__sidebar--left {

  background-color: red;

}


.content__sidebar--right {

  background-color: green;

}



.content__main {

  flex: 1;

}


.container {

  background: #808080;

  border: 1px solid #000000;

  height: 190px;

}


.footer {

  background: #808080;

  border: 1px solid #000000;

  height: 129px;

}

<div class="Header">

  <h1> Header </h1>

</div>


<div class="content">

  <div class="content__sidebar content__sidebar--left"></div>

 

  <div class="content__main">

    <div class="container">"

      <p> Text </p>

    </div>

    <div class="container">

      <p> Text </p>

    </div>

    <div class="container">

      <p> text </p>

    </div>

    <div class="container">

      <p> text </p>

    </div>

  </div>

  

  <div class="content__sidebar content__sidebar--right"></div>

</div>


<div class="footer">

  <p> footer </p>

</div>


查看完整回答
反對 回復 2023-10-24
?
翻翻過去那場雪

TA貢獻2065條經驗 獲得超14個贊

丑陋的方式: https:?//codepen.io/stefantigro/pen/bGdZyeX

<div class="Header">

? <h1> Header </h1>

</div>

<div class="">

? <div class="right-side side">


? </div>

? <div class="middle">

? ? <div class="container">

? ? <p> Text </p>

? </div>

? <div class="container">

? ? <p> Text </p>

? </div>

? <div class="container">

? ? <p> text </p>

? </div>

? <div class="container">

? ? <p> text </p>

? </div>

? <div class="footer">

? ? <p> footer </p>

? </div>

? </div>

? <div class="left-side side">


? </div>

</div>

body {

? font-family: Verdana, Arial, Helvetica, sans-serif;

? color: blue;

? margin: 0;

? padding: 0;

? width: 100%;

? background-color: black;

? background-size: cover;

? background-repeat: no-repeat;

}


.Header {

? height: 191px;

? background: #808080;

? border: 1px solid #000000;

? text-align: center;

? font-family: Arial, Helvetica, sans-serif;

? font-size: 30px;

}


.contentwrap {

? margin: 0 auto;

}


.container {

? background: #808080;

? border: 1px solid #000000;

? height: 190px;

? display: block;

}


.footer {

? background: #808080;

? border: 1px solid #000000;

? height: 129px;

}


.middle

{

? display: inline-block;

? width: 60%;

? height: 100%;

}


.right-side{

? background: blue;

}


.left-side{


? background: red;

}


.side{

? margin: 0;

? width: 19%;

? height: 800px;

? display: inline-block;

}

這里的問題是我們使用設定的尺寸,并且井的尺寸各不相同,尤其是從顯示器到顯示器。


查看完整回答
反對 回復 2023-10-24
  • 2 回答
  • 0 關注
  • 154 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號