1.html部分只需在<body ></body >之间编写一个div标签,给div标签使用layout作为id名称即可:<div id="layout">这里写入文章内容</div>;
2.接下来先为body编写css代码:(方法还是和“我的第一张css+div布局网页”一样,用鼠标编代码,呵呵!)
body {
margin: 0px;
padding: 0px;
background-attachment: fixed;
background-image: url(images/tupian/a017.jpg);
background-repeat: no-repeat;
background-position: left bottom;
}
再为layout编写css代码,确定宽高度外,我进行了绝对定位,设定了上下左右边框距离,为缩小右上角的背景图片,进行了负数设置。
#layout {
height: 480px;
width: 720px;
margin-top: 20px;
margin-right: 30px;
margin-bottom: 20px;
margin-left: 150px;
padding: 40px;
background-image: url(images/tupian/a017-2.jpg);
background-position: right -100px;
background-repeat: no-repeat;
border: thick double #f79a94;
font-family: "宋体";
font-size: 9pt;
color: #993300;
line-height: 150%;
}
如果需要一列固定宽度居中设置,只需把上面四个margin值改为:"margin: 0px auto;"即可。
新闻热点
疑难解答