定位的CSS速记 [英] CSS shorthand for positioning
本文介绍了定位的CSS速记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有顶部
右边
底部
left
或 width
和 height
?
我有很多CSS这样
#topDiv {
position:absolute;
top:0px;
left:0px;
right:0px;
height:100px;
}
#centerDiv {
position:absolute;
top:100px;
bottom:120px;
left:0px;
right:0px;
}
#consoleDiv {
position:absolute;
left:0px;
right:0px;
bottom:0px;
height:120px;
}
我想做这样的事情
position: absolute 10px 50px 50px 100px;
或
size: 400px 200px;
推荐答案
不存在将所有这些值。这些都是不同的属性,不同于例如 background
,其具有颜色,图像,位置和重复指令, / em>合并成一个短手形式。
No short-hand exists to combine all of these values. These are all different properties, unlike, for instance background
, which has colors, images, positions and repeat instructions and as such can be coalesced into a short-hand form.
如果你真的想要这种类型的控件,你可以使用像SASS,并创建一个 mixin 。
If you really wanted this type of control, you could use something like SASS and create a mixin.
这篇关于定位的CSS速记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文