css clear屬性_CSS中的clear屬性

css clear屬性

CSS | 清除財產 (CSS | clear Property)

We know so much about float property and how it is used for styling our web pages. If you do not remember the float property, let's help jog your memory. The float property is used to set the elements in a particular section of the web page. For e.g, if you set the property for an element as float:right; then that particular element will float to the right side of the page. But what about the time when we do not want that element to float in that part of the page?

我們對float屬性及其如何用于設置網頁樣式非常了解。 如果您不記得float屬性,讓我們來幫助您記憶一下。 float屬性用于設置網頁特定部分中的元素。 例如,如果您將元素的屬性設置為float:right; 那么該特定元素將浮動到頁面的右側。 但是,當我們不希望該元素在頁面的該部分中浮動時該怎么辦?

That is where clear property comes in.

那就是清除財產的地方。

The clear property is a very basic and easy property to apply. It is used to specify on which side of the page the floating elements should not float basically to clear that section of the page of the floating elements.

clear屬性是一個非常基本且易于應用的屬性。 它用于指定浮動元素基本上不應浮動在頁面的哪一側,以清除浮動元素頁面的該部分。

By using clear property it will be ensured that the element on which clear property is applied will not float to the specified area of the page. This property comes in handy very often when we do not want our elements to float either side of the web page.

通過使用clear屬性 ,將確保應用了clear屬性的元素不會浮動到頁面的指定區域。 當我們不希望元素在網頁的任何一側浮動時,此屬性通常會派上用場。

Implication

意義

To use the clear property not many lines of code are required all you gotta do is specify the side or section of the page where you do not want your floating elements to float.

要使用clear屬性,不需要很多代碼行,您要做的就是指定頁面中您不希望浮動元素浮動的一側或部分。

This could be understood clearly with the help of the following example:

通過以下示例可以清楚地理解這一點:

For e.g: if you do not want your elements to float on either side of the page(left or right), you must use this property as:

例如:如果您不希望元素在頁面的任一側(左或右)浮動,則必須將此屬性用作:

Syntax:

句法:

Element {
clear: both;
}

Note that to not allow floating elements to float on either side of the page, only both attribute was enough we did not use "right and wrong", which makes it quite shorthand too.

請注意,為了不讓浮動元素浮動在頁面的任何一側,僅兩個屬性就足夠了,我們沒有使用“對與錯” ,這也使其非常簡寫。

However, if you wish to restrict your floating elements from floating on a particular side of the page, for example, right then you will have to specify right as an attribute.

但是,例如,如果您希望限制浮動元素不浮動在頁面的特定一側,則必須將right指定為屬性。

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
img {
float: left;
}
p.clear {
clear: both;
}
</style>
</head>
<body>
<h1>clear property in CSS</h1>
<img src="https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg" width="140" height="142">
<p>this is a clear property example..this is a clear property example.this is a clear property example.this is a clear property example.this is a clear property example.this is a clear property example</p>
<p class="clear">this is a clear property example..this is a clear property example.this is a clear property example.this is a clear property example.this is a clear property example.this is a clear property example</p>
</body>
</html>

Output

輸出量

clear Property in CSS | Example 1

In the above example, remove the clear class to see the effect.

在上面的示例中,刪除clear類以查看效果。

Key points:

關鍵點:

Let us understand clear property more,

讓我們更多地了解清晰的屬性

The default value of the clear property is none. This means if you write none immediately after clear then no changes will be done to the floating elements.

clear屬性的默認值為none 。 這意味著,如果在清除后立即不寫任何內容,則不會對浮動元素進行任何更改。

To use this property in JavaScript, the syntax is different and it goes like this,

要在JavaScript中使用此屬性,語法會有所不同,就像這樣,

object.style.clear="both"

Below is a table that would explain the values of clear property in a much better way,

下面的表格將以更好的方式說明clear屬性的值,

Property values:

屬性值:

ValueDescription
noneA default value. It allows floating elements on either sides
leftThis does not allow floating elements on the left side.
rightThis does not allow floating elements on the right side.
bothThis does not allow floating elements on either side.
initialThis would set the property to its default value.
inheritThis helps in inheriting property from its parent element.
描述
沒有 默認值。 它允許在兩側浮動元素
剩下 這不允許左側有浮動元素。
這不允許在右側浮動元素。
這不允許任一側都有浮動元素。
初始 這會將屬性設置為其默認值。
繼承 這有助于從其父元素繼承屬性。

翻譯自: https://www.includehelp.com/code-snippets/clear-property-in-css.aspx

css clear屬性

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377347.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377347.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377347.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

linux find prune排除某目錄或文件

http://blog.csdn.net/ysdaniel/article/details/7995681 查找cache目錄下不是html的文件 find ./cache ! -name *.html -type f列出當前目錄下的目錄名,排除includes目錄,后面的-print不能少 find . -path ./includes -prune -o -type d -maxdepth 1 -print排除多個目錄,”(“…

嵌入式指針embedded pointer的概念以及用法

目錄前言概念用法參考前言 在針對一個class寫出它的內存管理池以及總結出allocator類(三個版本)中內存管理池的第二個版本中涉及到了一個非常重要的概念&#xff1a;嵌入式指針。同時嵌入式指針也在G2.9版本的alloc中出現。現在整理一下網上的一些用法和概念 概念 嵌入式指針…

CLI配置和編址

實施基本編址方案&#xff1a; 在設計新網絡或規劃現有網絡時&#xff0c;至少要繪制一幅指示物理連接的拓撲圖&#xff0c;以及一張列出以下信息的地址表&#xff1a; l 設備名稱 l 設計中用到的接口 l IP 地址和子網掩碼 l 終端設備&#xff08;如 PC&#xff09;的默…

sql語句中的in用法示例_PHP中的循環語句和示例

sql語句中的in用法示例循環 (Loops) Imagine that we need a program that says "hello world" 100 times. Its quite stressful and boring to write the statement -- echo "hello world" — 100 times in PHP. This is where loop statement facilitate…

love2d教程30--文件系統

在游戲里少不了文件操作&#xff0c;在love2d里我們可以直接用lua自帶的io函數&#xff0c;如果不熟悉可以先讀一下我的lua文件讀寫。 相對lua&#xff0c;love2d提供了更多的函數&#xff0c; 方便我們操作文件。不過可能處于安全考慮&#xff0c;love2d只允許我們訪問兩個目錄…

std::alloc具體細節

G2.9 std::alloc的缺點&#xff1a; 1、在alloc::deallocate中沒有將拿到的內存資源還給操作系統&#xff0c;在多任務中將占用很大資源 2、alloc::deallocate函數沒有檢查傳入的p指針的有效性。在這里它默認p為alloc::allocate取得。 如果p并非alloc::allocate取得&#xf…

修改函數的返回地址

這篇隨筆源自今天看的這篇文章http://www.cnblogs.com/bluesea147/archive/2012/05/19/2508208.html 1. 如何修改函數返回地址 今天主要寫測試程序思考和驗證了一下這個問題&#xff0c;先看一下這個&#xff23;程序 1 #include <stdio.h>2 void foo(){3 int a,…

調試JavaScript代碼

JavaScript調試代碼 (JavaScript debugging the code) Debugging is the process of finding mistakes or bugs in the program. There are several ways one can debug their JavaScript code. This article will walk you through the strict mode in JavaScript and excepti…

Delphi運算符及優先級

單目運算符 (最高優先級) 取變量或函數的地址(返回一個指針) not 邏輯取反或按位取反 乘除及按位運算符 * 相乘或集合交集 / 浮點相除 div 整數相除 mod 取模 (整數相除的余數) as 程序運行階段類型轉換 (RTTI運算符) and 邏輯或按位求和 shl 按位左移 shr 按位右移 加減運算符…

NotifyMyFrontEnd 函數背后的數據緩沖區(二)

message level 函數pq_putmessage調用 low level 函數 pq_putbytes,pq_putbytes調用 internal_putbytes。 從internal_putbyes上來看&#xff0c;就可以發現其數據發送的機制:有一個小技巧&#xff0c;如果數據緩沖區滿了&#xff0c;就發送&#xff0c;否則就先堆在那兒。如果…

從源碼角度剖析VC6下的內存分配與切割的運作

目錄前言1、heap初始化2、第一次分配內存&#xff0c;計算真正區塊大小3、new_region管理中心4、__sbh_alloc_new_group()切割第一次分配好的內存5、開始切割內存前言 malloc與free帶來的內存管理是應付小區塊的&#xff0c;即SBH(small block heap)&#xff0c;這點也可以從源…

windows常見命令整理(持續更新)

windows常見命令整理 1. 文件1.1. 實時顯示文件 logfile.txt 中新添加的內容&#xff08;類似于linux tail -f&#xff09; 2. 網絡2.1. netstat 3. 進程和任務3.1. tasklist &#xff08;用于列出當前運行的進程及其詳細信息&#xff09;3.2. wmic &#xff08;用于執行各種系…

最長公共子序列求序列模板提_最長公共子序列

最長公共子序列求序列模板提Description: 描述&#xff1a; This question has been featured in interview rounds of Amazon, MakeMyTrip, VMWare etc. 這個問題在亞馬遜&#xff0c;MakeMyTrip&#xff0c;VMWare等訪談輪次中都有介紹。 Problem statement: 問題陳述&…

洛必達法則使用條件

使用條件 1、分子分母同趨向于0或無窮大 。 2、分子分母在限定的區域內是否分別可導。 3、當兩個條件都滿足時&#xff0c;再求導并判斷求導之后的極限是否存在&#xff1a;若存在&#xff0c;直接得到答案&#xff1b;若不存在&#xff0c;則說明此種未定式無法用洛必達法則解…

求根號m(巴比倫算法)

巴比倫算法是針對求根號m的近似值情況的&#xff0c;它的思想是這樣的&#xff1a; 設根號mX0,則如果枚舉有答案X(X<X0)&#xff0c;則m/X>X0,當精度要求不高的時候&#xff0c;我們可以看成Xm/XX0,而如果精度要求比較高&#xff0c;我們只需取X和m/X的平均值作為新的枚舉…

Android面試題

http://blog.csdn.net/aomandeshangxiao/article/category/841452 http://www.cppblog.com/life02/category/18316.html轉載于:https://www.cnblogs.com/DonkeyTomy/articles/2598673.html

r語言 分類變量 虛擬變量_R語言中的變量

r語言 分類變量 虛擬變量R語言| 變數 (R Language | Variables) In the previous tutorial, we have come across the basic information that stands as a pavement for understanding the R language in depth. Now moving future let us educate ourselves about the concep…

算法題復習(快排、鏈表、二分、哈希、雙指針)

目錄1、快速排序復習2、鏈表部分復習203. 移除鏈表元素707. 設計鏈表206. 反轉鏈表142.環形鏈表 II3、二分法復習4、哈希法復習5、雙指針復習**15. 三數之和****18. 四數之和****27. 移除元素****344. 反轉字符串**,簡單&#xff0c;雙指針從兩側往中間靠攏&#xff0c;并隨時s…

Cassandra1.2文檔學習(7)—— 規劃集群部署

數據參考&#xff1a;http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/architecture/architecturePlanningAbout_c.html 當規劃一個Cassandra集群部署時&#xff0c;關于你初始存儲的數據的數據量你應當有一個好的想法&#xff0c;并且對于…

虛擬機設置NAT

需要開啟虛擬機網絡相關服務&#xff0c; 安裝虛擬網卡&#xff0c; 還有必須安裝 VMware ToolsVMware虛擬機下實現NAT方式上網1. 把你的虛擬網卡VMnet8設置為自動獲得IP、自動獲得DNS服務器&#xff0c;啟用。2. 把你虛擬機中操作系統的“本地連接”也設置為自動獲得IP、自動獲…