博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
css中图片左右边距_CSS中的边距
阅读量:2530 次
发布时间:2019-05-11

本文共 2130 字,大约阅读时间需要 7 分钟。

css中图片左右边距

CSS保证金属性 (CSS margin property)

CSS Margins are used to space around any element, for this we use "margin" property in the CSS.

CSS边距用于在任何元素之间留出空间,为此,我们在CSS中使用“ margin”属性

Syntax:

句法:

Element{        margin: length|auto|initial|inherit;    }

保证金崩溃 (Margin Collapsing)

When two margins are touching each other vertically, they are collapsed. But when they touch horizontally, they do not collapse.

当两个边距垂直相互接触时,它们将被折叠。 但是,当它们水平接触时,它们不会塌陷。

Example:

例:

        
Some content
Some more content

Output

输出量

Margins in CSS | Example 1

They will be 20px apart since vertical margins collapse over one and other. (The spacing will not be the sum of two margins.)

由于垂直边距会彼此重叠,因此相距20px 。 (间距将不是两个边距的总和。)

在给定边上应用保证金 (Apply Margin on a Given Side)

In CSS you can specify a given side to apply a margin too. The four properties provided for this purpose are,

在CSS中,您也可以指定给定边以应用边距。 为此目的提供的四个属性是:

  • margin-left

    左边距

  • margin-right

    右边距

  • margin-top

    上边距

  • margin-bottom

    底边

Example:

例:

        
Some content

Output

输出量

Margins in CSS | Example 2

负边距 (Negative Margins)

CSS has properties that can be set to negative values. This property can be used to overlap elements without absolute positioning.

CSS具有可以设置为负值的属性。 此属性可用于重叠元素而无需绝对定位。

Example:

例:

        
Some content

Output

输出量

Margins in CSS | Example 3

保证金属性简化 (Margin property simplification)

Here the shorthand is used to specify margin in every direction without writing for every direction.

在这里,速记用于指定每个方向上的边距,而无需为每个方向编写。

Example:

例:

        

Some content

Output

输出量

Margins in CSS | Example 4

边距CSS:length | auto | initial | inherit (CSS for margin: length|auto|initial|inherit)

margin: 1px;    margin: 1px 1px;    margin: 1px 1px 1px;    margin: 1px 1px 1px 1px;

左,右,上和下边距 (Left, Right, Top and Bottom Margins)

To provide margins for left, right, top and bottom to an object, we can use margin-left, margin-right, margin-top and margin-bottom properties respectively.

要为对象的左侧,右侧,顶部和底部提供边距,我们可以分别使用margin-leftmargin-rightmargin-topmargin-bottom属性。

Example:

例:

        

This is line One.

This is line Two.

This is line Three.

This is line Four.

Output

输出量

Margins in CSS | Example 5

翻译自:

css中图片左右边距

转载地址:http://ditzd.baihongyu.com/

你可能感兴趣的文章
openssl 升级
查看>>
2017.10.30 天晴 昨天十公里没减肥
查看>>
Git 打标签(分布式版本控制系统)
查看>>
ASP.NET MVC:通过 FileResult 向 浏览器 发送文件
查看>>
CVE-2010-2883Adobe Reader和Acrobat CoolType.dll栈缓冲区溢出漏洞分析
查看>>
使用正确的姿势跨域
查看>>
AccountManager教程
查看>>
Android学习笔记(十一)——从意图返回结果
查看>>
算法导论笔记(四)算法分析常用符号
查看>>
HttpClient读取数据乱码的解决方案
查看>>
如何使用FireBug插件查询元素的xPath属性
查看>>
ultraedit激活
查看>>
总结(6)--- python基础知识点小结(细全)
查看>>
亿级曝光品牌视频的幕后设定
查看>>
ARPA
查看>>
JSP开发模式
查看>>
我的Android进阶之旅------>Android嵌入图像InsetDrawable的使用方法
查看>>
Detours信息泄漏漏洞
查看>>
win32使用拖放文件
查看>>
Android 动态显示和隐藏软键盘
查看>>