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.mzph.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、自动获…