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 marginbottom attribute in css

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how to use the marginbottom attribute in css. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Margin-bottom is a property of CSS, and all major browsers support the margin-bottom attribute. Margin, is the CSS syntax, this abbreviated attribute is used to set the width of all current or specified element outer margins in a declaration, or to set the width of the outer margins of each edge.

Introduction to marginbottom

Margin-bottom

Grammar editing

Margin-bottom: [| | auto] {1pm 4}

Default value: 0

Related attributes: [margin] | | [margin-top] | | [margin-right] | | [margin-left]

Value editing

Auto:

Value is set to the value of the relative edge

:

The outer white space is defined by the length value. Can be a negative value

:

The percentage is used to define the external blanking. Can be a negative value

Description editing

Retrieves or sets the extension margin of the bottom edge of the object.

In order for an inline object to use this attribute, you must first make the object appear at the block level or inline block level.

The epitaxial margin is always transparent.

The corresponding script feature is marginBottom.

Concise writing method of marginbottom

Margin, like padding, is written succinctly. We can use the margin property to set the outer margins in four directions. In actual programming, we often use the efficient and concise writing method of margin to program.

There are 4 ways to write margin, which are as follows:

Margin: pixel value 1

Margin: pixel value 1 pixel value 2

Margin: pixel value 1 pixel value 2 pixel value 3

Margin: pixel value 1 pixel value 2 pixel value 3 pixel value 4

The above four positions are in order: margin-top--margin-right--margin-bottom--margin-left, that is, "top-right-bottom-left". The following abbreviation is top--right--bottom--left. It is important to note that in the latter three cases, when there is a default pixel value, the browser automatically assigns the default pixel values according to the "bottom=top" and "left=right" methods.

For example:

"margin:20px;" indicates that the outer margins in all four directions are 20px.

"margin:20px40px;" means that top is 20px, and right is 40px; because bottom and left default, they are automatically set to 20px and 40px, respectively. Converted to the fourth way of writing: "margin:20px40px20px40px;".

"margin:20px40px60px;" means that top is 20px, left right is 40px, and bottom is 60px; because it defaults, it is automatically set to 40px. Converted to the fourth way of writing: "margin:20px40px60px40px;".

It is important to note that one situation cannot be written as the default: "margin:20px40px20px60px;". In this example, because top and bottom are the same, but right and left are different, bottom cannot be set by default, otherwise it will be equivalent to "margin:20px40px60px40px;".

Thank you for reading! This is the end of this article on "how to use marginbottom attributes in css". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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