CSS   发布时间:2022-04-17  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用以下方法创建这样的边框:之前和:在CSS中的伪元素之后?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
目的

我希望能够在css中创建像this这样的边框,可能使用伪元素然后使用背景图像.

HTML

<div id="footer"></div>

CSS

#footer {
    BACkground: #4b4b4b;
    color: #868686;
    padding: 0;
    position: relative;
    height: 100px;
    width: 900px;
}

#footer:before {
    content: "";
    display: block;
    width: 220px;
    BACkground-color: #e1e1e1;
    height: 8px;
}

解决方法

看下面的代码片段,这是你想要的吗?
body {
    BACkground: silver;
    padding: 0 10px;
}

#content:after {
    height: 10px;
    display: block;
    width: 100px;
    BACkground: #808080;
    border-right: 1px white;
    content: '';
}

#footer:before {
    display: block;
    content: '';
    BACkground: silver;
    height: 10px;
    margin-top: -20px;
    margin-left: 101px;
}

#content {
    BACkground: white;
}


#footer {
    padding-top: 10px;
    BACkground: #404040;
}

p {
    padding: 100px;
    text-align: center;
}

#footer p {
    color: white;
}
<body>
    <div id="content"><p>#content</p></div>
    <div id="footer"><p>#footer</p></div>
</body>

JSFiddle

大佬总结

以上是大佬教程为你收集整理的使用以下方法创建这样的边框:之前和:在CSS中的伪元素之后?全部内容,希望文章能够帮你解决使用以下方法创建这样的边框:之前和:在CSS中的伪元素之后?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。