


What are the common types of html layouts? Analysis of three layout characteristics of html
What are the common types of html layouts? There are three layout methods in HTML: fluid layout, floating layout and layer model. Each of these three layout methods in HTML has its own characteristics. This article will briefly talk about the characteristics of the three layout methods in HTML.
1. Fluid layout (the default layout of html web pages)
Features:
1. Block elements will Extend vertically in order from top to bottom within the containing element, because by default, the width of block elements is 100%.
2. Inline elements will be displayed horizontally from left to right within the containing element. (Inline elements are not as domineering as block elements that occupy one line)
2. Floating layout (float)
Features: Under the default layout , block elements are so overbearing that they occupy one row. Now if we want two block elements to be displayed side by side. You need to use float to achieve this.
As follows
div{ width:200px; height:200px; border:2px red solid; float:right; }
3. Layer model
Features: If I want a div to be on top of another div, We need to be able to use absolute positioning to complete the three positioning methods of the layer model: relative, absolute, fixed
Absolute positioning (absolute)
Need to set position:absolute (indicating absolute positioning), the function of this statement is to drag the element out of the document flow,
and then use the left, right, top, and bottom attributes to perform absolute positioning relative to its closest parent containing block with a positioning attribute. .
If there is no such containing block, it is relative to the body element, that is, relative to the browser window.
Relative positioning (relative)
If you want to set the relative positioning in the layer model for the element, you need to set position:relative (indicating relative positioning),
it Determine the offset position of the element in the normal document flow through the left, right, top, and bottom attributes.
The process of relative positioning is to first generate an element in static (float) mode (and the element floats like a layer),
then moves relative to the previous position, and the direction and amplitude of the movement are determined by left and right , top, and bottom attributes are determined, and the position before offset is retained.
Fixed positioning (fixed)
fixed: indicates fixed positioning, similar to the absolute positioning type,
but its relative movement coordinates are in the view (in the screen the web page window) itself.
Since the view itself is fixed, it will not change with the scroll bar of the browser window,
Unless you move the screen position of the browser window on the screen, or change the display size of the browser window,
So the fixedly positioned element will always be located somewhere in the view within the browser window and will not be affected by the flow of the document.
This has the same function as the background-attachment:fixed; attribute.
Note:
When using the z-index attribute, only elements that use the position attribute have the z-index attribute. Elements that do not use the position attribute do not have the z-index attribute, and it is useless if it is set.
Recommended related articles:
Use HTML and HTML to implement common layouts_html/css_WEB-ITnose
The above is the detailed content of What are the common types of html layouts? Analysis of three layout characteristics of html. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Implementing a full-screen mask layout is one of the common requirements in web design, which can add a strong sense of mystery and unique effects to the web page. In this article, HTML and CSS will be used to implement a simple full-screen mask layout, and specific code examples will be given. First, let's create the HTML structure. In the HTML file, we will use a div element as a container for the mask and add content inside it, as shown below: <!DOCTYPEhtml><html>

How to create a slide layout page using HTML and CSS Introduction: Slide layout is widely used in modern web design and is very attractive and interactive when displaying information or pictures. This article will introduce how to create a slide layout page using HTML and CSS, and provide specific code examples. 1. HTML layout structure First, we need to create an HTML layout structure, including a slide container and multiple slide items. The code looks like this: <!DOCTYPEhtml&

HTML layout skills: How to use positioning layout to control the absolute positioning of the page In Web development, page layout is a very critical element. Positioning layout is a commonly used layout method that allows developers to more flexibly control the position of elements on the page. This article will introduce how to use positioning layout to control the absolute positioning of the page, and provide specific code examples. 1. Overview of Positioning Layout Positioning layout refers to determining the position of elements on the page based on their position attributes. In CSS, there are three main positioning methods: relative positioning,

How to use HTML and CSS to implement a simple chat page layout With the development of modern technology, people increasingly rely on the Internet for communication and communication. In web pages, chat pages are a very common layout requirement. This article will introduce you to how to use HTML and CSS to implement a simple chat page layout, and give specific code examples. First, we need to create an HTML file, you can use any text editor. Taking index.html as an example, first create a basic HTML

How to create a responsive card wall layout using HTML and CSS In modern web design, responsive layout is a very important technology. By using HTML and CSS, we can create a responsive card wall layout that adapts to devices of different screen sizes. Here’s a closer look at how to create a simple responsive card wall layout using HTML and CSS. HTML part: First, we need to set up the basic structure in the HTML file. We can use unordered list (<ul>) and

How to use HTML and CSS to implement a detailed page layout HTML and CSS are the basic technologies for creating and designing web pages. By using these two appropriately, we can achieve various complex web page layouts. This article will introduce how to use HTML and CSS to implement a detailed page layout and provide specific code examples. Create an HTML structure First, we need to create an HTML structure to place our page content. The following is a basic HTML structure: <!DOCTYPEhtml&g

How to Create a Responsive Video Playback Page Layout Using HTML and CSS In today’s Internet age, videos have become an integral part of our daily lives. More and more websites and applications provide video playback functions. In order to provide a better user experience, developers need to create a responsive video playback page layout to adapt to different devices and screen sizes. This article details how to achieve this using HTML and CSS, and provides specific code examples. Step 1: HTML Structure First, I

HTML Layout Guide: How to Use Floating Elements to Implement Multi-Column Layout When browsing web pages, we often see layouts composed of multiple columns, such as the homepage of a news website, product display page, etc. This multi-column layout makes web pages more organized and beautiful by dividing content into columns and displaying them side by side. In HTML, we can use floating elements to achieve such a multi-column layout. This article will show you how to use floating elements to implement a multi-column layout and provide specific code examples. Basic concepts in using floating elements to implement multi-column layout
