Home >Web Front-end >Front-end Q&A >What does clear mean in html5

What does clear mean in html5

WBOY
WBOYOriginal
2021-12-21 18:00:263384browse

In html5, clear means "clear" and is a style attribute used to clear floating elements around the element. The syntax is "clear:value" or "Object.style.clear=value". The default In this case, the attribute value is "none", which means that floating elements are allowed to appear around the element.

What does clear mean in html5

The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.

What does clear mean in html5

In html, clear means clear.

The clear attribute specifies which side of the element does not allow other floating elements.

The clear attribute defines which sides of the element are not allowed to have floating elements. In CSS1 and CSS2, this was accomplished by automatically adding a top margin to clear elements (i.e., elements with the clear property set). In CSS2.1, clear space is added above the element's upper margin, but the margin itself does not change. Regardless of the change, the end result is the same. If it is declared as left or right clear, the upper border of the element will be just below the lower margin of the floating element on that side.

The example is as follows:

<html>
<head>
<style type="text/css">
img
  {
  float:left;
  clear:both;
  }
</style>
</head>
<body>
<img  src="/i/eg_smile.gif" / alt="What does clear mean in html5" >
<img  src="/i/eg_smile.gif" / alt="What does clear mean in html5" >
</body>
</html>

Output result:

What does clear mean in html5

Recommended tutorial: "html video tutorial"

The above is the detailed content of What does clear mean in html5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn