CSS - 定位

标签 css positioning

一个。图片 (960x7) b. div(宽度:960,填充:10)

我想定位 (a),使其距顶部 50 像素,居中。 我想将 (b) 放置在 (a) 的正下方,没有空格。

我的 CSS 如下:

@charset "utf-8";
* {margin:0;padding:0;}
body {background-color:#999;}
.pagetop {margin:50 auto;background:url(../img/pgtop.gif) top center no-repeat;}
.page {margin:0 auto;width:960px;background-color:#fff;padding:10px;}

我的 HTML 如下:

<body>
<div class="pagetop" />
<div class="page">
<p>Warning <a href="#">sign</a>, warning sign...I see it but I...pay it no mind.</p>
</div>

我正在尝试创建一个在灰色背景上具有圆 Angular 边缘的白色容器。我怎样才能简单而智能地做到这一点?

最佳答案

检查圆边的这个问题:

CSS Rounded corners

对于对象的定位,我会采用这样的方式:

topimage {
   position: absolute;
   top: 50px;
   text-algin: center;
}

关于CSS - 定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1132880/

相关文章:

javascript - 如何根据一天中的时间替换图像

javascript - 使用按钮计数器更新 Chart.js

javascript - 当切换标签时,谷歌图表会失去它们的风格

html - 将较高的图像定位在较小的 div 的内部或 "on top"

html - 无论窗口大小如何,都将图像定位在溢出的中心

javascript - 自动检测移动设备或分辨率并相应地调整 CSS

html - Css 侧边栏静态

javascript - Jquery:为什么这个if-else语句只跟随if或else,但当它们是可以满足的不同条件时不会跟随两者

CSS居中技巧

javascript - 位置 div 取决于距离浏览器边缘(javascript)