這篇文章主要介紹了css3中float屬性怎么用,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
10年積累的成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站制作后付款的網(wǎng)站建設(shè)流程,更有沙灣免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
css中,float屬性用于定義元素在哪個(gè)方向浮動(dòng),語(yǔ)法為“元素{float:value}”;當(dāng)屬性的值為“l(fā)eft”可設(shè)置元素向左浮動(dòng);當(dāng)屬性的值設(shè)置為“right”可設(shè)置元素向右浮動(dòng);當(dāng)屬性的值設(shè)置為“none”可設(shè)置元素不浮動(dòng)。
本教程操作環(huán)境:windows10系統(tǒng)、CSS3&&HTML5版、Dell G3電腦。
float屬性定義元素在哪個(gè)方向浮動(dòng)。以往這個(gè)屬性總應(yīng)用于圖像,使文本圍繞在圖像周圍,不過在 CSS 中,任何元素都可以浮動(dòng)。浮動(dòng)元素會(huì)生成一個(gè)塊級(jí)框,而不論它本身是何種元素。
如果浮動(dòng)非替換元素,則要指定一個(gè)明確的寬度;否則,它們會(huì)盡可能地窄。
假如在一行之上只有極少的空間可供浮動(dòng)元素,那么這個(gè)元素會(huì)跳至下一行,這個(gè)過程會(huì)持續(xù)到某一行擁有足夠的空間為止。
該屬性的屬性值如下:
示例如下:
<html> <head> <style type="text/css"> img { float:right } </style> </head> <body> <p>在下面的段落中,我們添加了一個(gè)樣式為 <b>float:right</b> 的圖像。結(jié)果是這個(gè)圖像會(huì)浮動(dòng)到段落的右側(cè)。</p> <p> <img src="/i/eg_cute.gif" /> This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </p> </body> </html>
輸出結(jié)果:
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“css3中float屬性怎么用”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!
當(dāng)前題目:css3中float屬性怎么用
轉(zhuǎn)載注明:http://chinadenli.net/article24/giohce.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、搜索引擎優(yōu)化、網(wǎng)站導(dǎo)航、外貿(mào)建站、定制網(wǎng)站、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)