关于CSS背景颜色与边框距离的问题

html-css010

关于CSS背景颜色与边框距离的问题,第1张

你好,根据你说的,不知道是不是这个效果:

代码如下:

css:

<style type="text/css">

#bg{width:250pxheight:200pxborder:1px solid #dddbackground-color:#eeepadding:0px 5px 0px 5px}

#content{height:100%background-color:#fff}

</style>

html:

<div id="bg">

<div id="content">

中间的内容

</div>

</div>

只要定义父级div(即:bg)的宽度即可,里面的内容会自适应。希望对你有帮助!:-)

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:img {position: absolutebottom: 80pxz-index: -1}。

3、浏览器运行index.html页面,此时实现了背景图片距离底部80px大小。