CSS:background-color只在边缘内 [英] CSS: background-color only inside the margin

查看:180
本文介绍了CSS:background-color只在边缘内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索过一个答案,但找不到任何地方。我的问题很简单:我有一个背景颜色我的身体,然后一个大的边缘,现在我想要一个不同的背景颜色里面的边缘。

I have searched for an answer but couldn't find it anywhere. My question is reasonably simple: I have a background color of my body, then a large margin, and now I want a different background color inside the margin.

如何使用CSS?

推荐答案

如果您的边距设置在身体上, html标签的颜色应该为边距区域着色

If your margin is set on the body, then setting the background color of the html tag should color the margin area

html { background-color: black; }
body { margin:50px; background-color: white; }

http:/ /jsfiddle.net/m3zzb/

或者像dmackerman的建议一样,设置一个0的边距,但边框的大小,你想要的边距,设置border-color

Or as dmackerman suggestions, set a margin of 0, but a border of the size you want the margin to be and set the border-color

这篇关于CSS:background-color只在边缘内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆