我正在学习CSS并且因相对布局而感到困惑.如果您为定位提供冲突的属性值会发生什么?例如left: 50px;和right 50px;
我试着自己,从我可以告诉,right总是得到,如果有两个下降left和right.还有什么关于topvs bottom?
例
<!DOCTYPE html>
<html>
<head>
<style>
div.relative {
position: relative;
left: 30px;
right: 30px;
border: 10px solid #73AD21;
}
</style>
</head>
<body>
<h2>position: relative;</h2>
<p>Lorem Ipsum insert text here....</p>
<div class="relative">
This div element has position: relative;
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)