简体   繁体   English

边框立体风格,尺寸缩短

[英]Border solid style with shortened dimensions

I'm trying to make a border for the top of a div element. 我正在尝试为div元素的顶部设置边框。 The border is a 1px thick solid line, and it is to make a noticeable division between the footer and the website content. 边框是1像素粗的实线,用于在页脚和网站内容之间进行明显的区分。 However, I don't want the border to span the whole width of the footer. 但是,我不希望边框跨越页脚的整个宽度。 I'd instead like it to be shorter (by maybe 10 pixels or so on each side) and centered. 相反,我希望它更短(每边大约10像素左右)并居中。 How should I do this? 我应该怎么做? Does it require me to use an image? 是否需要我使用图像?

You mean something like this: http://jsfiddle.net/8ZSSc/ 您的意思是这样的: http : //jsfiddle.net/8ZSSc/

Or, if you always wanted exactly 10px short of each side regardless of page size: 或者,如果无论页面大小如何,您总是希望每边正好短10px:

http://jsfiddle.net/8ZSSc/2/ http://jsfiddle.net/8ZSSc/2/

只需使用<hr />标记制作一条水平线,然后为其设置宽度。

我想您正在寻找这样的东西:

<div style="width: 95%; border-top: 1px solid; margin: auto;"></div>

Add another div above the footer, add a top border, and use padding to make it narrower: 在页脚上方添加另一个div,添加顶部边框,并使用填充使其变窄:

.footer-line {
    border-top: ...
    margin-right: 10px;
    margin-left: 10px;
}

您可能在页脚上方还有一个很细的div

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM