Implicitly changing the display type

Source: Internet
Author: User
Implicitly changing the display type

One interesting phenomenon is that when you set one of the following 2 sentences for an element (regardless of what type of element was previously, Display:none):

  1. Position:absolute
  2. Float:left or Float:right

The element automatically becomes display:inline-block, and of course you can set the width and height of the element and the default width does not fill the parent element.

As the following code, the small partners know that a tag is an inline element, so setting its width is not effective, but set to Position:absolute later, it is OK.

<div class= "Container" >    <a href= "#" title= "" > Enter course click here </a></div>

CSS Code

<style>.container a{    Position:absolute;    width:200px;    Background: #ccc;} </style>

Can't think of what Display:inline-block is doing. Click the element category-inline block element to return to the previous section for review.

Implicitly changing the display type

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.