When are 'Inline-block” and 'float” used? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:41:28
Original
1271 people have browsed it

When are Inline-block and float used? ? ?

Sometimes “Inline-block” and “float” can achieve the effect of horizontal arrangement. When should they be used respectively? ? ?

What situations are they suitable for? ? ?




Reply to discussion (solution)

Questions like this
Actually you should say it first What is the implementation effect of these two? How can it affect your application due to partially overlapping functions?

"float" is mainly used for column layout;

Inline elements (inline elements) are Attributes such as width, padding-left, padding-right, etc. cannot be set.
If you need to set these attributes and do not want them to occupy a row of space, you need to set this inline "display: inline-block";

"inline-block" is not used very much. In most cases, "block" can replace "inline-block".

"Inline elements (inline elements) cannot set properties such as width, padding-left, padding-right, etc." This sentence is wrong.
Except for , inline elements cannot be set. width, height, padding-top, padding-bottom, margin-top, margin-bottom.

The explanations above are very good! Generally speaking, it is necessary to make the elements have the characteristics of inline elements at the same time, and at the same time, specifically control the width and height. There is a compatibility problem. Float is used for typesetting out of the document flow!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template