css讓塊靠右的實現(xiàn)方法

這篇文章主要介紹css讓塊靠右的實現(xiàn)方法,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

成都創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務,包含不限于成都網(wǎng)站制作、做網(wǎng)站、連云港網(wǎng)絡推廣、微信小程序開發(fā)、連云港網(wǎng)絡營銷、連云港企業(yè)策劃、連云港品牌公關、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務,您的肯定,是我們最大的嘉獎;成都創(chuàng)新互聯(lián)為所有大學生創(chuàng)業(yè)者提供連云港建站搭建服務,24小時服務熱線:18982081108,官方網(wǎng)址:muchs.cn

css想讓塊靠右的實現(xiàn)方法:可以通過float屬性來實現(xiàn),如【float:right;】,表示元素向右浮動。float屬性用于定義元素在哪個方向浮動,left表示元素向左浮動,right表示元素向右浮動。

相關元素:

float 屬性定義元素在哪個方向浮動。以往這個屬性總應用于圖像,使文本圍繞在圖像周圍,不過在 CSS 中,任何元素都可以浮動。浮動元素會生成一個塊級框,而不論它本身是何種元素。

屬性值:

  • left    元素向左浮動。

  • right    元素向右浮動。

  • none    默認值。元素不浮動,并會顯示在其在文本中出現(xiàn)的位置。

  • inherit    規(guī)定應該從父元素繼承 float 屬性的值。

代碼實現(xiàn):

<html>
<head>
<style type="text/css">
img 
{
float:right
}
</style>
</head>

<body>
<p>在下面的段落中,我們添加了一個樣式為 <b>float:right</b> 的圖像。結果是這個圖像會浮動到段落的右側。</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>

實現(xiàn)效果:

css讓塊靠右的實現(xiàn)方法

以上是“css讓塊靠右的實現(xiàn)方法”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

本文名稱:css讓塊靠右的實現(xiàn)方法
分享URL:http://muchs.cn/article4/ipggoe.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供云服務器、網(wǎng)站改版網(wǎng)站設計、網(wǎng)站內(nèi)鏈、網(wǎng)站營銷、自適應網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設