Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the css one-sided margin attribute

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "css single margin attribute how to use", the content is easy to understand, clear, hope to help you solve doubts, the following let Xiaobian lead you to study and learn "css single margin attribute how to use" this article.

You can use the single-sided margin attribute to configure values for the outer margin on one side of the element. Suppose you want to configure the left margin of the p element to 20px. Instead of using margin (you need to type a lot of auto), you can do the following:

P {margin-left: 20px;}

You can apply any of the following properties to configure only the outer margins on the response without directly affecting all other outer margins:

Margin-top

Margin-right

Margin-bottom

Margin-left

Multiple such unilateral attributes can be used in a delineation, such as:

H3 {margin-top: 20px; margin-right: 30px; margin-bottom: 30px; margin-left: 20px;}

Admittedly, it is easier to use the margin outline for this situation:

P {margin: 20px 30px 30px 20px;}

Whether you use unilateral attributes or use margin, you will get the same result in the end. In general, it is easier to use margin if you want to configure outer margins for multiple edges. However, from the point of view of the emergence of documents, it is not necessary to use either way in practice, so we should decide on a simpler path for me.

Implication and confession

Hint: the default margin (margin) value for body tags signed by Netscape and IE is 8px. And Opera is not so much. Similarly, Opera defines the default value of padding as 8px, so if you are eager to adjust a small piece of the edge of the entire site and roughly display it in Opera, then you must define the padding development of body.

The above is all the content of this article entitled "how to use the css single margin attribute". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report