第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

嘗試使用 Flex 規(guī)則將 Flex 容器中的文本左對(duì)齊

嘗試使用 Flex 規(guī)則將 Flex 容器中的文本左對(duì)齊

胡說(shuō)叔叔 2024-01-03 17:10:29
我有一個(gè)包含笑話列表的部分,其中每個(gè)笑話都單獨(dú)包含在 div 中。在每個(gè)笑話中有兩個(gè)段落,我試圖將它們對(duì)齊以顯示在左側(cè)(彈性容器的開(kāi)頭)?,F(xiàn)在我面臨的兩個(gè)主要問(wèn)題是第一段(Q:)沒(méi)有與容器的開(kāi)頭對(duì)齊我正在嘗試對(duì)齊段落,以便縮寫(xiě)和問(wèn)題都換行到容器內(nèi)容的最左邊邊界。我面臨的第二個(gè)問(wèn)題是第二段 (A:) 始終在容器中居中,而不是顯示在左側(cè)。我不確定為什么第一段不居中,但第二段在顯示網(wǎng)頁(yè)時(shí)居中。有人告訴我,這可以通過(guò)我一直試圖在div p規(guī)則集中找到的單個(gè)彈性規(guī)則來(lái)實(shí)現(xiàn)。總的來(lái)說(shuō),我正在努力實(shí)現(xiàn)這種預(yù)期的顯示:超文本標(biāo)記語(yǔ)言 <section id="jokes">        <h2>Out Of This World Joke Inventory!</h2>        <p>Hover over each joke to see the answer!</p>        <div id="joke-cards">          <div id="sun-joke">            <img src="img/icon1.png" alt="Icon of shooting star">            <hr>            <p><span class="abbrv">Q:</span> Why did the sun go to school?</p>            <p><span class="abbrv">A:</span> <span class="answer">To get brighter!</span></p>          </div>          <div id="tick-joke">            <img src="img/icon2.png" alt="Icon of rocket blasting off">            <hr>            <p><span class="abbrv">Q:</span> What do you call a tick on the moon?</p>            <p><span class="abbrv">A:</span> <span class="answer">A luna-tick</span></p>          </div>          <div id="restaurant-joke">            <img src="img/icon3.png" alt="Icon of flag on the Moon">            <hr>            <p><span class="abbrv">Q:</span> Why did the people not like the restaurant on the moon?</p>            <p><span class="abbrv">A:</span> <span class="answer">Because there was no atmosphere.</span></p>          </div>     </div></section>
查看完整描述

2 回答

?
狐的傳說(shuō)

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超3個(gè)贊

用于align-items: flex-start;div,width+ marginforimg和text-align: left;forp


img{ width: 50%; outline: 1px solid blue; margin: 0 auto; }

#joke-cards {

  display: flex;

  flex-wrap: wrap;

  align-items: center;

  justify-content: space-evenly;

}


#joke-cards div {

  display: flex;

  flex-direction: column;

  align-items: flex-start;

  margin-top: 15px;

  margin-left: 15px;

  margin-right: 15px;

  margin-bottom: 15px;

  height: 400px;

  width: 300px;

  background-color: #9B580D;

  opacity: 80%;

  padding: 20px;

}


#joke-cards div img {

  height: 150px;

  width: 150px;

}


hr {

  width: 65%;

}


div p {

  text-align: left;

}


.abbrv {

  font-size: 28px;

  color: #E0DBD7;

}


.answer {

  display: none;

  font-size: 24px;

  color: #191919;

}


#joke-cards div:hover .answer {

  display: inline;

}

<section id="jokes">

  <h2>Out Of This World Joke Inventory!</h2>

  <p>Hover over each joke to see the answer!</p>

  <div id="joke-cards">

    <div id="sun-joke">

      <img src="img/icon1.png" alt="Icon of shooting star">

      <hr>

      <p><span class="abbrv">Q:</span> Why did the sun go to school?</p>

      <p><span class="abbrv">A:</span> <span class="answer">To get brighter!</span></p>

    </div>


    <div id="tick-joke">

      <img src="img/icon2.png" alt="Icon of rocket blasting off">

      <hr>

      <p><span class="abbrv">Q:</span> What do you call a tick on the moon?</p>

      <p><span class="abbrv">A:</span> <span class="answer">A luna-tick</span></p>

    </div>


    <div id="restaurant-joke">

      <img src="img/icon3.png" alt="Icon of flag on the Moon">

      <hr>

      <p><span class="abbrv">Q:</span> Why did the people not like the restaurant on the moon?</p>

      <p><span class="abbrv">A:</span> <span class="answer">Because there was no atmosphere.</span></p>

    </div>

  </div>

</section>


查看完整回答
反對(duì) 回復(fù) 2024-01-03
?
米脂

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超3個(gè)贊

您必須將段落標(biāo)簽包裝到一個(gè)容器中,該容器將具有 place-items 屬性,而不是每個(gè)段落。此外,您需要將顯示值從塊更改為繼承每個(gè)內(nèi)容段落。


<div class="content">

   <p><span class="abbrv">Q:</span> Why did the sun go to school?</p>

   <p><span class="abbrv">A:</span> <span class="answer">To get brighter!</span></p>

</div>

div.content{

    display: flex;

    flex-direction: column;

    width: 100%;

    place-self: flex-start;

}


div.content p {

    display:inherit;

}


查看完整回答
反對(duì) 回復(fù) 2024-01-03
  • 2 回答
  • 0 關(guān)注
  • 226 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)