How to use float? css: float floating usage summary
For developers, float needs to be used frequently, and they are basically inseparable from it, but they often endure all the pain it brings to you. Maybe you think it has only a little knowledge, but you really Can you control it? CSS float is what we call label objects floating to the left (float:left) and floating to the right (float:right). Floating can be understood as making a DIV element break away from the standard flow and float on the standard flow. It is not at the same level as the standard flow. This chapter will talk about how to use float.
You can first learn free courses related to php Chinese website
1. Learn "CSS Online Manual" CSS Float(Floating) Course
2. Watch "Dark Horse Programmer CSS Video Tutorial" The floating chapter in
#float floating related content
1.Detailed explanation of the usage of float that you don’t know
The original design intention of float is to achieve a mixed arrangement of pictures and text, so that the text can surround the picture. Today's usage is basically to achieve horizontal layout. Although it is a "misuse", it can often achieve the effect we want. Most people know how to use float, but not everyone knows the principle and original design intention of float. 2.css float-float/clear detailed graphic and text explanation
If a p element A is floating, and if the previous element of A element is also floating, Then the A element will follow the previous element (if these two elements cannot be placed on one line, then the A element will be squeezed to the next line); if the previous element of the A element is an element in the standard stream, then the relative verticality of A The position will not change, which means that the top of A is always aligned with the bottom of the previous element. 3.The correct usage of float, 90% of people use it incorrectly
float also has a very useful feature, which is to clear spaces. I won’t post a picture of this, just a description. For example, if I put a picture in a p, there will be a few pixels of space between the pictures by default, which can also be called a gap. But often this gap or space is not what we need. At this time, we only need to give the image a float to separate it from the document flow, and the images will fit together perfectly. 4.Two ways to adapt the height of multiple div floating floats in css
When using Div + CSS for three-column or two-column layout, make two columns (or three columns) have the same height, which is easy to achieve with Table, but it is more troublesome to use Div + CSS. According to the general practice, most of them use background image filling or JS script to make the height the same. 5.Detailed explanation of float floating in CSS
The origin of a.floatThe original design of floating is used to create a wrapping effect for text, which is also the design What the author wants us to do.
b.float parameters There are three parameter values for the float attribute: Left: Indicates that the element floats on the left. Right: Indicates that the element floats to the right. None: The object does not float and follows the standard document flow. c. Effect display (take float: left as an example, the case of float: right is just a difference in position) 6.CSS basic knowledge - detailed introduction to float
Floating has 4 attributes: left (left floating), right (right floating), none (not floating), inherit (inherit).The containing block of a floating element is its nearest block-level ancestor element.
The floating element will be offset left (or right) until its outer boundary touches the "inner boundary of the containing block" or "the outer boundary of another floated element".Related Questions and Answers
1.How to solve the problem of float elements falling
2.When using the float attribute in html, the height of the parent element will become 0. How to solve it?
3. Under what circumstances will float fail?
【Related Recommendations】
1. Free tutorial on php Chinese website: "CSS 0 Basic Introductory Tutorial"
2. php Chinese Free online video tutorial: "php.cn Dugu Jiujian (2) - css video tutorial"
The above is the detailed content of How to use float? css: float floating usage summary. 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

AI Hentai Generator
Generate AI Hentai for free.

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



How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

Answer: You can use the date picker component of Bootstrap to view dates in the page. Steps: Introduce the Bootstrap framework. Create a date selector input box in HTML. Bootstrap will automatically add styles to the selector. Use JavaScript to get the selected date.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

To verify dates in Bootstrap, follow these steps: Introduce the required scripts and styles; initialize the date selector component; set the data-bv-date attribute to enable verification; configure verification rules (such as date formats, error messages, etc.); integrate the Bootstrap verification framework and automatically verify date input when form is submitted.

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.
