HTML+CSS Easy to Get Started with Inline Block Elements

Inline-block elements have the characteristics of both inline elements and block elements

So how to set elements as inline block elements

display:inline-block;

Note: (new in css2.1), , tags are such inline block tags.

Characteristics of inline block elements


1, and other elements are on the same line;

2 , the element's height, width, line height, and top and bottom margins can all be set.

Let’s write an example below to set the width, height, background color, etc. for an a tag. The a tag is an inline element by default, and the width and height have no effect.

The code is as follows:

      
欢迎大家来到php中文网

As shown in the above code, when we convert the a tag into an inline block element, we can set the width and height

Continuing Learning
||
欢迎大家来到php中文网
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!