How to clear margins in css

WBOY
Release: 2021-12-03 17:55:41
Original
8934 people have browsed it

How to clear margins in css: 1. Use the margin attribute to clear the outer margin of the element, the syntax is "element {margin:0px;}"; 2. Use the padding attribute to clear the inner margin of the element, the syntax is " Element {padding:0px;}".

How to clear margins in css

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

How to clear margins in css

1. Create a new Clear Margins and Padding.html file and enter the HTML5 structure code , modify the content in the title tag to: clear the outer margins and inner margins, define multiple tags, such as: div, span, etc.

Run the web page, right-click --> View elements, you can You can see that the body tag has margins (the yellow part is the margin), as shown in the picture:

How to clear margins in css

How to clear margins in css

##2 , use the * wildcard selector to set the margin and padding of all labels to 0px, and clear the inner and outer margins of all labels, as shown in the figure:

How to clear margins in css

Run the web page again to see element, you can see that the inner and outer margins have been cleared, as shown in the figure:

How to clear margins in css

(Learning video sharing:

css video tutorial)

The above is the detailed content of How to clear margins in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!