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

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

具有傾斜邊的形狀(響應(yīng))

具有傾斜邊的形狀(響應(yīng))

UYOU 2019-06-04 16:51:00
具有傾斜邊的形狀(響應(yīng))我正在嘗試創(chuàng)建一個形狀,如下圖中的只在一側(cè)傾斜邊緣(例如,底部)而其他邊則保持直線。我嘗試使用邊框方法(下面給出代碼),但是形狀的尺寸是動態(tài)的,因此我不能使用這個方法。.shape {    position: relative;    height: 100px;    width: 200px;    background: tomato;}.shape:after {    position: absolute;    content: '';    height: 0px;    width: 0px;    left: 0px;    bottom: -100px;    border-width: 50px 100px;    border-style: solid;    border-color: tomato tomato transparent transparent;}<div class="shape">    Some content</div>我也嘗試過對背景使用梯度(如下面的代碼),但是隨著維度的變化,它會變得一團糟。在下面的片段中,你可以看到我在形狀上盤旋的意思。.gradient {  display: inline-block;  vertical-align: top;  height: 200px;  width: 100px;  margin: 10px;  color: beige;  transition: all 1s;  padding: 10px;  background: linear-gradient(45deg, transparent 45%, tomato 45%) no-repeat;}.gradient:hover {  width: 200px;}<div class="gradient"></div>我如何創(chuàng)建這個有傾斜邊的形狀也能支持動態(tài)尺寸?
查看完整描述

2 回答

?
忽然笑

TA貢獻1806條經(jīng)驗 獲得超5個贊

我的解決方案被稱為方法7-查看端口單元上面這頁是Andrea Ligios寫的。

我也用“水平”單位來表示高度。height:10vw當調(diào)整導(dǎo)航窗口的寬度時,要在梯形中保持給定的比例。我們可以稱之為方法7b-視口寬度.

此外,使用兩個嵌套的divS,而不是一個和:after在我看來,選擇器允許更好地調(diào)整文本內(nèi)容樣式。text-align等等)。

.dtrapz {

  position: relative;

  margin: 10px 40vw;

  width: 0;

  height: 10vw;

  border: none;

  border-right: 20vw solid #f22;

  border-bottom: 5vw solid transparent;

}


.dtcont {

  position: absolute;

  width: 20vw;

  height: 10vw;

  text-align: center;

  color: #fff;/* just aesthetic */

}

<div class="dtrapz">

  <div class="dtcont">Some content</div>

</div>


查看完整回答
反對 回復(fù) 2019-06-04
  • 2 回答
  • 0 關(guān)注
  • 684 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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