如何使用CSS绝对定位无图像角
我正在寻找一种方法来绝对定位以下 css 样式中使用的四个角。我尝试了以下方法,但这不是正确的方法。
.rbottom{display:block; background:#f57f20; position:absolute; top:500px;}
这是原来的CSS:
.container5 {background:#666666; color:#fff; margin:0 15px;}
.rbottom{display:block; background:#f57f20;}
.rtop{display:block; background:#eaeade;}
.rtop *, .rbottom *{display: block; height: 1px; overflow: hidden; background:#666666;}
.r1{margin: 0 5px}
.r2{margin: 0 3px}
.r3{margin: 0 2px}
.r4{margin: 0 1px; height: 2px}
.rl1 {margin: 0 0 0 5px; }
.rl2 {margin: 0 0 0 3px; }
.rl3 {margin: 0 0 0 2px; }
.rl4 {margin: 0 0 0 1px; height: 2px;}
.rr1 {margin: 0 5px 0 0; }
.rr2 {margin: 0 3px 0 0; }
.rr3 {margin: 0 2px 0 0; }
.rr4 {margin: 0 1px 0 0; height: 2px;}
I'm looking for a way to absolute position the four corners used in the following css style. I tried the following, but that wasn't the right one.
.rbottom{display:block; background:#f57f20; position:absolute; top:500px;}
This is the original css:
.container5 {background:#666666; color:#fff; margin:0 15px;}
.rbottom{display:block; background:#f57f20;}
.rtop{display:block; background:#eaeade;}
.rtop *, .rbottom *{display: block; height: 1px; overflow: hidden; background:#666666;}
.r1{margin: 0 5px}
.r2{margin: 0 3px}
.r3{margin: 0 2px}
.r4{margin: 0 1px; height: 2px}
.rl1 {margin: 0 0 0 5px; }
.rl2 {margin: 0 0 0 3px; }
.rl3 {margin: 0 0 0 2px; }
.rl4 {margin: 0 0 0 1px; height: 2px;}
.rr1 {margin: 0 5px 0 0; }
.rr2 {margin: 0 3px 0 0; }
.rr3 {margin: 0 2px 0 0; }
.rr4 {margin: 0 1px 0 0; height: 2px;}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前还不完全清楚你在问什么。在 CSS 中绝对定位某些内容的方法是使用
position:absolute
属性,然后指定该元素应定位的位置,例如:另一方面,听起来您正在尝试实现CSS 圆角。如果您不介意 IE 中的角是方形(而不是圆角),则可以使用特定于浏览器的 CSS3 圆角属性:
该属性应该适用于 Firefox、Safari 和 Google Chrome,但不适用于任何版本的 IE。
It's not entirely clear what you're asking. The way to position something absolutely in CSS is to use the
position: absolute
property, and then specify where that element should be positioned, e.g.:On the other hand, it sounds like you're trying to implement CSS rounded corners. If you don't mind your corners being square (not rounded) in IE, you can use the browser-specific CSS3 rounded corner properties:
Which should work on Firefox, Safari, and Google Chrome, but not any version of IE.
假设
.container5
是所有角的包装器,您是否尝试向其添加position:relative;
?assuming that
.container5
is the wrapper for all the corners, have you tried to addposition: relative;
to it?