新聞中心
這篇文章主要介紹css讓塊靠右的實現(xiàn)方法,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
css想讓塊靠右的實現(xiàn)方法:可以通過float屬性來實現(xiàn),如【float:right;】,表示元素向右浮動。float屬性用于定義元素在哪個方向浮動,left表示元素向左浮動,right表示元素向右浮動。
相關(guān)元素:
float 屬性定義元素在哪個方向浮動。以往這個屬性總應(yīng)用于圖像,使文本圍繞在圖像周圍,不過在 CSS 中,任何元素都可以浮動。浮動元素會生成一個塊級框,而不論它本身是何種元素。
屬性值:
left 元素向左浮動。
right 元素向右浮動。
none 默認值。元素不浮動,并會顯示在其在文本中出現(xiàn)的位置。
inherit 規(guī)定應(yīng)該從父元素繼承 float 屬性的值。
代碼實現(xiàn):
在下面的段落中,我們添加了一個樣式為 float:right 的圖像。結(jié)果是這個圖像會浮動到段落的右側(cè)。
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.
實現(xiàn)效果:
以上是“css讓塊靠右的實現(xiàn)方法”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
標題名稱:css讓塊靠右的實現(xiàn)方法-創(chuàng)新互聯(lián)
URL標題:http://www.dlmjj.cn/article/eppjj.html