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

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

如何在不添加太多內容的情況下增加圖像的背景尺寸?

如何在不添加太多內容的情況下增加圖像的背景尺寸?

慕桂英546537 2023-12-11 16:02:22
我正在嘗試在背景上添加背景圖像,我可以做到這一點,但它沒有顯示我使用此代碼的圖像的完整尺寸。當我嘗試使用背景大小自動時,我得到了正確的寬度,但高度很小,我知道這取決于內容大小。但還是有什么辦法<div style="background: url('https://firebasestorage.googleapis.com/v0/b/growthfilepractice.appspot.com/o/1%20(2).jpg?alt=media&token=48244df9-a2bb-412a-81f5-854e2dbc4939');background-repeat: no-repeat;background-size:500px 500px;">  <a href ="https://github.com/" style="text-decoration: none;">    <table>      <tr>        <td><h3 style="color: #fff;">Amarjeet Singh</h3></td>      </tr>      <tr>      </tr>    </table>  </a></div>
查看完整描述

2 回答

?
慕絲7291255

TA貢獻1859條經驗 獲得超6個贊

該圖像被設置為您的背景<div>,因此它的大小將取決于該圖像的width和。因此,如果高度較大,則會顯示更多內容。只是為了說明,請檢查下面我的代碼。我已經給出了a ,現在圖像顯示了該高度。height<div>background-image<div>height : 600px


因此,簡而言之,您的背景圖像僅顯示元素的大小。元素越大,圖像就會出現越多。


<div  class="container" 

      style=" height: 600px; /* Just to illustrate */

              position: relative;

              background: url('https://firebasestorage.googleapis.com/v0/b/growthfilepractice.appspot.com/o/1%20(2).jpg?alt=media&token=48244df9-a2bb-412a-81f5-854e2dbc4939');

              background-repeat: no-repeat;

            background-size:500px 500px;">

  <a  class="nameAnchor" 

      href ="https://github.com/" 

      style=" text-decoration: none;

              position: absolute;

              color: white;

              left: 10px; /* Set your Left position here */

              top: 100px; /* set your top position here */

  ">

    <span>Amarjeet Singh</span>

  </a>

</div>


查看完整回答
反對 回復 2023-12-11
?
絕地無雙

TA貢獻1946條經驗 獲得超4個贊

我建議你設置背景大小:封面。如果您想要的話,這會自動將其設置為完整尺寸。



查看完整回答
反對 回復 2023-12-11
  • 2 回答
  • 0 關注
  • 143 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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