Differences between using float and display: block to convert inline elements into block elements: floatblock

Source: Internet
Author: User

Differences between using float and display: block to convert inline elements into block elements: floatblock

Differences between using float and display: block to convert inline elements into block elements:
Suggestion: writing code as much as possible can effectively improve learning efficiency and depth.
Inline elements can be converted into block-level elements. For example, you can use the float attribute to float inline elements or add a display: block to inline elements. Both of them can convert inline elements into block-level elements, but they are different. The code example is as follows:

<! DOCTYPE html> 

The above Code uses float to convert Element a to a block-level element. It can be seen that the width is determined based on the content. Let's look at a code example:

<! DOCTYPE html> 

The code above adds the display: block for element a to convert it into an accounting element, but the width is not determined based on the content, but the default state is width: 100%.
There may be more differences between the two. You are welcome to leave a message to add.

The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 4615.

For more information, see: http://www.softwhy.com/divcss/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.