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

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

讓 SVG 充當(dāng)塊元素

讓 SVG 充當(dāng)塊元素

ibeautiful 2023-09-25 17:03:12
我一直在試圖弄清楚如何讓我的 SVG 元素充當(dāng) display: 塊。我想要一個(gè)位于 SVG 正下方的圖像,但它始終與 SVG 重疊。我嘗試將屬性更改為“display: block”以及在 SVG 元素本身周?chē)鷦?chuàng)建一個(gè) div 容器,但似乎沒(méi)有任何效果。我確信有一個(gè)簡(jiǎn)單的方法,我只是想不出來(lái)。#svg{        position: absolute;        left: 0;        right: 0;        margin: auto;        z-index: -1;        display: block;        margin-bottom: 10px;        display: block;    }    #svgContainer{        display: block;        width: 90%;        margin: auto;    }    #seasonImage{        background-image: url('images/summer.png');        width: 120%;        margin-left: -30px;        height: auto;        background-repeat:no-repeat;        background-size: contain;        height:200px;        display: block;        position: relative;    }<div id="svgContainer">  <svg id="svg" viewBox="-10 -10 220 220" width="90%">    <text x="80" y="106" id="currentTemp" font-size="18" font-weight="bold" style="fill: #C9AC68">{{currentTemp}}&#176;</text>    <circle class="background" cx="100" cy="100" r="35" stroke="#C9AC68" />    <circle class="background" cx="100" cy="100" r="55" stroke="#B25538" />    <circle class="background" cx="100" cy="100" r="75" stroke="#507282" />    <circle class="background" cx="100" cy="100" r="95" stroke="#7E8959" />                  <circle id="line1" class="overlayLine" cx="100" cy="100" r="35" stroke="#C9AC68" stroke-dasharray="0, 3000" stroke-dashoffset="126" transform="rotate(-90,100,100)" />    <circle id="line2" class="overlayLine" cx="100" cy="100" r="55" stroke="#B25538" stroke-dasharray="0, 3000" stroke-dashoffset="188" transform="rotate(-90,100,100)" />    <circle id="line3" class="overlayLine" cx="100" cy="100" r="75" stroke="#507282" stroke-dasharray="0, 3000" stroke-dashoffset="251" transform="rotate(-90,100,100)" />    <circle id="line4" class="overlayLine" cx="100" cy="100" r="95" stroke="#7E8959" stroke-dasharray="0, 3000" stroke-dashoffset="314" transform="rotate(-90,100,100)" />  </svg></div><div id="seasonImage"></div>
查看完整描述

1 回答

?
Helenr

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

您的 CSS 設(shè)置position: absolute為該svg元素。與靜態(tài)定位的元素不同,絕對(duì)定位的元素不占用其容器所需的空間。top瀏覽器將它們放置在您用、left、right和指定的坐標(biāo)處bottom,無(wú)論它是在任何其他元素的下面還是上面。


從#seasonImage元素的角度來(lái)看,沒(méi)有任何東西占據(jù)其自身上方的空間。因此,瀏覽器將其放置在其容器的頂部,與絕對(duì)定位的 SVG 重疊。


如果我們注釋掉或刪除position: absolute;(及其相關(guān)屬性),瀏覽器會(huì)將圖像直接放置在 SVG 下方。


#svg {

  /*position: absolute;

      left: 0;

      right: 0;*/

  margin: auto;

  /*z-index: -1;*/

  display: block;

  margin-bottom: 10px;

  display: block;

}


#svgContainer {

  display: block;

  width: 90%;

  margin: auto;

}


#seasonImage {

  background-image: url('https://cataas.com/cat?26');

  width: 120%;

  margin-left: -30px;

  height: auto;

  background-repeat: no-repeat;

  background-size: contain;

  height: 200px;

  display: block;

  position: relative;

}

<div id="svgContainer">

  <svg id="svg" viewBox="-10 -10 220 220" width="90%">

            <text x="80" y="106" id="currentTemp" font-size="18" font-weight="bold" style="fill: #C9AC68">{{currentTemp}}&#176;</text>

            <circle class="background" cx="100" cy="100" r="35" stroke="#C9AC68" />

            <circle class="background" cx="100" cy="100" r="55" stroke="#B25538" />

            <circle class="background" cx="100" cy="100" r="75" stroke="#507282" />

            <circle class="background" cx="100" cy="100" r="95" stroke="#7E8959" />


            <circle id="line1" class="overlayLine" cx="100" cy="100" r="35" stroke="#C9AC68" stroke-dasharray="0, 3000" stroke-dashoffset="126" transform="rotate(-90,100,100)" />

            <circle id="line2" class="overlayLine" cx="100" cy="100" r="55" stroke="#B25538" stroke-dasharray="0, 3000" stroke-dashoffset="188" transform="rotate(-90,100,100)" />

            <circle id="line3" class="overlayLine" cx="100" cy="100" r="75" stroke="#507282" stroke-dasharray="0, 3000" stroke-dashoffset="251" transform="rotate(-90,100,100)" />

            <circle id="line4" class="overlayLine" cx="100" cy="100" r="95" stroke="#7E8959" stroke-dasharray="0, 3000" stroke-dashoffset="314" transform="rotate(-90,100,100)" />

        </svg>

</div>


<div id="seasonImage"></div>


查看完整回答
反對(duì) 回復(fù) 2023-09-25
  • 1 回答
  • 0 關(guān)注
  • 109 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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