What attribute in css can set margins for elements

王林
Release: 2023-02-16 18:49:53
Original
5291 people have browsed it

The margin attribute in css can set margins for elements. The margin attribute defines the space around an element, which clears the area around the outer border of the element. The margin property can change the top, bottom, left, and right margins of an element individually, or it can change all properties at once.

What attribute in css can set margins for elements

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In CSS, you can use the margin attribute to add margins to elements. The margin attribute can define the space around the element.

Note:

margin clears the surrounding (outer border) area of the element. The margin has no background color and is completely transparent.

margin You can change the top, bottom, left, and right margins of the element individually, or you can change all attributes at once.

What attribute in css can set margins for elements

Attribute value:

  • auto Set the browser margins.

  • length Define a fixed margin (using pixels, pt, em, etc.)

  • % Define a margin using percentage

Example:

    php.cn  

这是一个没有指定边距大小的段落。

这是一个指定边距大小的段落。

Copy after login

Running results:

What attribute in css can set margins for elements

##(Learning video sharing:

css video tutorial)

The above is the detailed content of What attribute in css can set margins for elements. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!