摘要:屬性實(shí)現(xiàn)效果屬性設(shè)置元素的垂直對(duì)齊方式。允許指定負(fù)長度值和百分比值。中間文字,兩邊橫線看到網(wǎng)上有把設(shè)置為的,試了一下感覺和設(shè)置的有沖突效果不太合適。所以將設(shè)置到上了偽類實(shí)現(xiàn)效果中間文字兩邊橫線
1. vertical-align屬性實(shí)現(xiàn)效果:
vertical-align 屬性設(shè)置元素的垂直對(duì)齊方式。
該屬性定義行內(nèi)元素的基線相對(duì)于該元素所在行的基線的垂直對(duì)齊。允許指定負(fù)長度值和百分比值。
<div class="header"> <span class="line">span> <span class="text">中間文字,兩邊橫線span> <span class="line">span> div> <style> .header { width:400px; height:36px; line-height:36px; border:1px solid green; text-align:center; } .line { display:inline-block; width:100px; border-top:1px solid #cccccc; vertical-align:5px;
//看到網(wǎng)上有把.text設(shè)置為vertical-align:-5px的,試了一下感覺和.header設(shè)置的line-height有沖突,效果不太合適。所以將vertical-align設(shè)置到.line上了 } style>
2. css偽類實(shí)現(xiàn)效果:
<div class="header">
<div>中間文字,兩邊橫線div>
div>
<style> .header { width:400px; height:36px; line-height: 36px; text-align:center; border:1px solid green; position:relative; } .header div:before,.header div:after { position:absolute; background:#ccc; content:""; height:1px; top:50%; width:100px; } .header div:before{left:10px;} .header div:after{right:10px;} style>
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/1663.html
效果: showImg(https://segmentfault.com/img/bVbleHt?w=1115&h=453); Document .title{ text-align: center; position: relative; height: ...
效果: showImg(https://segmentfault.com/img/bVbleHt?w=1115&h=453); Document .title{ text-align: center; position: relative; height: ...
摘要:主要功能就是拖動(dòng)標(biāo)尺變動(dòng)價(jià)格。整個(gè)標(biāo)尺的長度為,步長為元。金額顯示首先,增加一個(gè)輸入框,然后獲取它。輸入金額移動(dòng)標(biāo)尺標(biāo)尺的移動(dòng)除了拖動(dòng)以外,我們也希望通過金額輸入框來達(dá)到。 效果源碼 終于到年底了,再過兩天我也要回家過年了,想想就激動(dòng)呢!今天給大家?guī)硪粋€(gè)基于移動(dòng)端的canvas價(jià)格選擇效果。 showImg(https://segmentfault.com/img/bV3QGd?w...
摘要:先讓它們浮動(dòng),并給和一個(gè)固定寬度,寬度,清除浮動(dòng)流,結(jié)果變成上面這樣。工作的越久,有些基礎(chǔ)知識(shí)我們可能就逐漸淡忘了,今天我們來回顧一下css的圣杯布局和雙飛翼布局, 這兩個(gè)名詞你可能不熟, 那三欄布局你肯定就非常熟悉了, 就是兩邊定寬, 中間自適應(yīng) 的 布局? 1 , 圣杯布局?? 三欄布局 center left right footer 首先HTML結(jié)構(gòu)...
閱讀 2348·2021-08-26 14:14
閱讀 2705·2019-08-29 13:07
閱讀 2116·2019-08-26 11:44
閱讀 698·2019-08-26 10:11
閱讀 2444·2019-08-23 15:43
閱讀 3102·2019-08-23 14:17
閱讀 417·2019-08-23 12:36
閱讀 2150·2019-08-22 15:20