search
HomeWeb Front-endCSS TutorialSeveral properties of CSS display, float, clear, overflow, visibility

http://colobu.com/2014/08/28/CSS-display-float-clear-overflow-visibility/

display property:block/inline/none

display :block (the function is to display the row attribute label as a block attribute label, and the width and height can be set);
display: inline (the function is to display the block attribute label as a row attribute label, and the width and height cannot be set for the block attribute label at this time) ; The difference between display:none and display:none is that the latter will not occupy that position, and the next element will directly cover it, while the former will occupy that layout, but does not display the content and is blank; and when downloading, display:none will Elements that are not displayed will not be downloaded, but visibility: hidden will download elements that are not displayed;

float (floating, still subject to document flow restrictions) can be set after the row label float Its width and height

float: none/left/right

none: Object does not float

left: Left float

right: Right float

clear(
Clear floats

)

clear: both/none/left/rightnone: Allow floating objects on both sides

both: No floating objects allowed

left: Not allowed There are floating objects on the left
right: Floating objects on the right are not allowed

overflow (overflow)

overflow: visible/auto/hidden/scroll

visible: Content is not cut Do not add scroll bars

auto: Default properties

hidden: Hide beyond content
scroll: Always display scroll bars

visibility(visible)

visibility: inherit/ visible/hidden

inherit: Inherit the visibility of the previous parent object

visible: Object visible

hidden: Object hidden

Differences in several image formats:

gif: Translucent is not supported

jpg: Transparent is supported

png: Transparent is partially supported and requires additional processing


==============

http://www.studyofnet.com/news/398.html

1. Block-level elements: block element

Every By default, block-level elements occupy one row of height. Once a block-level element is added to a row, other elements cannot be added (except after float). When two block-level elements are edited continuously, they will automatically wrap and display on the page. Block-level elements can generally nest block-level elements or inline elements;

Block-level elements generally appear as containers to organize structures, but this is not always the case. Some block-level elements, such as
, can only contain block-level elements. Other block-level elements can contain line-level elements such as

. Others can contain both block-level and line-level elements.

p is the most commonly used block-level element, and the display:block element style is all block-level elements. They are always expressed in the form of a block, and are arranged vertically in sequence with the sibling blocks of the same level, filling up the left and right sides.

2. Inline element: inline element

is also called

inline Element

, inline elements, etc.; inline elements are generally based on basic elements at the semantic level and can only accommodate text or other inline elements. The common inline element "a" is common. For example, SPAN elements, IFRAME elements and element style display: inline are all inline elements. For example, elements such as text are arranged horizontally between letters and automatically wrap to the right end.

3. Characteristics of block elements

① Always on a new line Start;


②, height, line height, margins and padding can all be controlled;


③, the width defaults to 100% of its container, Unless you set a width.


④. It can accommodate inline elements and other block elements



4. Characteristics of inline elements

①, and other elements are on the same line;


②, height, line height, outer margins and inner margins cannot be changed;


③. The width is the width of its text or picture and cannot be changed.

④. Inline elements can only accommodate text or other inline elements


For inline elements, please note the following

    Setting the width width is invalid.
  • Setting the height height is invalid and can be set through line-height.
  • #Setting margin Only left and right margins are valid, upper and lower margins are invalid.
  • # Setting padding is only valid for left and right padding, but not for top and bottom. Note that the scope of the element is increased, but the content around the element is not affected.


5. Common block elements

address – address
  • blockquote – Block quote

  • center – Center alignment block

  • dir – Directory listing

  • p – Commonly used block level, also the main tag of CSS layout

  • dl – Definition list

  • fieldset – form control group

  • form – interactive form

  • h1 – title

  • h2 – Subtitle

  • h3 – Level 3 heading

  • h4 – Level 4 heading

  • ##h5 – Level 5 heading

  • h6 – Level 6 heading

  • hr – Horizontal separator line

  • isindex – input prompt

  • menu – menu list

  • noframes – frames optional content, (this block is displayed for browsers that do not support frames Content

  • noscript – optional script content (displayed for browsers that do not support script)

  • ol – ordered form

  • p – paragraph

  • pre – formatted text

  • table – table

  • ul – Unordered list

6. Common inline elements

  • a – anchor

  • abbr – abbreviation

  • acronym – first letter

  • b – bold (not recommended)

  • bdo – bidi override

  • big – big font

  • br – line break

  • cite – quote

  • code – computer code (when citing source code Required)

  • dfn – Define fields

  • em – Emphasis

  • font – Font setting (Not recommended)

  • i – italic

  • #img – image

  • input – input box

  • kbd – Define keyboard text

  • label – Table label

  • q – Short quote

  • s – dash (not recommended)

  • samp – definition sample computer code

  • select – item selection

  • small – small font text

  • span – commonly used inline container, defining blocks within text

  • strike – strikethrough

  • strong – bold emphasis

  • sub – subscript

  • sup – superscript

  • textarea – multi-line text input box

  • tt – telex text

  • u – Underline

7. What is the difference between inline elements and block-level elements?

Difference 1:

Block level: Block level elements will occupy one line by default. Automatically fill the width of its parent element

Inline:Inline elements will not occupy a row, and adjacent inline elements will be arranged on the same line. Its width changes with the content.

Difference 2:

Block level: Block level elements can set width and height

Inline: The width and height of inline elements cannot be set

Difference three:

Block level: Block-level elements can be set with margin and padding

Inline: Margin-left; margin-right; padding-left; padding- right;can take effect. But the vertical margin-bottom; margin-top; padding-top; padding-bottom; does not take effect.

Difference four:

Block level: display:block;

Inline :display:inline;

You can switch between block-level elements and inline elements by modifying the display attribute



The above is the detailed content of Several properties of CSS display, float, clear, overflow, visibility. 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
比较:Apple Studio Display vs Samsung Smart Monitor M8比较:Apple Studio Display vs Samsung Smart Monitor M8May 11, 2023 pm 10:46 PM

三星智能显示器M8与AppleStudio显示器:设计和尺寸自推出以来,AppleStudioDisplay就被比作iMac,由相对简单的L形支架上的相对薄的面板组成。这是一种众所周知且深受喜爱的美学,三星似乎借用了它的展示。三星SmartMonitorM8采用了与外观非常相似的支架上的薄屏幕的相同想法。一些次要元素有所不同,例如左下角的小部分有点突出,三星的下巴很薄,但它们在基本设计方面似乎很接近。三星似乎从24英寸iMac中获得了很多灵感。苹果的显示器比三星的要小

Apple Studio Display 的电源线是可拆卸的,但需要特殊工具Apple Studio Display 的电源线是可拆卸的,但需要特殊工具May 17, 2023 pm 03:05 PM

AppleStudioDisplay现已在商店正式发售,全球已有多家客户购买了该产品。与ProDisplayXDR不同,StudioDisplay有一个独特的电源连接器,似乎是不可拆卸的。事实证明,电缆是可拆卸的,但您需要使用特殊工具才能将其卸下。苹果在其网站上表示,StudioDisplay的电源线是不可拆卸的——而且很多用户都这么认为。那是因为用你的双手移除电缆似乎是不可能的,但幸运的是,电缆可以从显示器上分离。,Apple有一个特殊的工具,用于从其新的StudioDispl

对比:Apple Studio Display vs LG UltraFine 5K Display 哪个好?对比:Apple Studio Display vs LG UltraFine 5K Display 哪个好?Apr 16, 2023 pm 08:25 PM

StudioDisplay和LGUltraFine5KDisplay在市场上占有相似的位置,但苹果的显示器要贵300美元。以下是您需要了解的有关这些显示器如何比较的所有信息。六年在科技领域是一段很长的时间,而这也是苹果出售一款价格不超过5,000美元的品牌显示器以来的时间。在此期间,Apple与LG合作销售专门迎合Mac用户的LGUltraFine系列。2019年,Apple停止销售这些LG显示器,转而支持ProDisplayXDR,这在价格适中的Mac友好显

display是什么意思display是什么意思Oct 26, 2023 am 11:50 AM

display通常指的是将数据、信息或结果以某种方式展示给用户或输出到屏幕或其他设备上的操作或功能。具体含义:1、在命令行界面(CLI)中,display可能指的是将文本、表格或其他格式的数据输出到终端窗口,供用户查看或分析;2、在图形用户界面(GUI)中,display可能指的是将图像、文本、图表等内容显示在应用程序的窗口或界面上,以供用户交互或浏览等等。

Boot Camp 更新以支持 Apple Studio DisplayBoot Camp 更新以支持 Apple Studio DisplayMay 20, 2023 pm 11:34 PM

在Mac上运行Windows的IntelMac用户现在可以更新BootCamp中的驱动程序,以支持Apple的StudioDisplay。Apple会定期更新BootCamp,以引入对新硬件的支持,以及典型的兼容性和性能改进。在3月份的软件更新中,Apple已启用BootCamp以与新的StudioDisplay配合使用。将BootCamp带到6.1.17版的更新引入了两个关键支持元素。首先,它增加了对StudioDisplay的兼容性,确

display有哪些取值display有哪些取值Nov 20, 2023 pm 05:28 PM

display的取值有block、inline、none、inline-block、flex、grid、table、inline-table和list-item等。详细介绍:1、block,将元素渲染为块级元素,块级元素在页面上形成一个块,并且独占一行;2、inline,将元素渲染为内联元素。内联元素不会独占一行,可以与其他元素并排;3、none,此值指定元素不会在页面上等等。

Apple Studio Display 适用于 Windows,但有一些限制Apple Studio Display 适用于 Windows,但有一些限制Apr 14, 2023 pm 03:49 PM

Apple本周发布了StudioDisplay,它采用27英寸5K面板,结合了摄像头、麦克风和扬声器,当用户将显示器连接到Mac时,它们可以协同工作。窗户呢?如果出于某种原因您需要在WindowsPC上使用Apple的1599美元显示器,您可以,但有一些限制。当通过Thunderbolt连接(并非每台PC都支持)插入WindowsPC时,StudioDisplay被识别为常规显示器。也就是说,如果您购买了其中一个以将其与Windows一起使用,则需要记

Google Pixel 8 display problems: Repair program enables 3 years of free serviceGoogle Pixel 8 display problems: Repair program enables 3 years of free serviceJun 15, 2024 pm 06:50 PM

SincethelaunchoftheGooglePixel8(approx.513eurosatAmazon,limited-timedeal),therehavebeenanincreasingnumberofreportsfromuserscomplainingaboutaverticallineonthedisplay.Thiscanmanifestitselfindifferentways-thecolorand

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.