javascript - 在 CSS 中使用 Javascript/jQuery 使 border-right 镜像 border-bottom?

标签 javascript jquery css

首先,让我为我的无知道歉。我是一名刚开始尝试学习的新开发人员,但我在这里遇到了障碍。我将简要说明我的 WP 设置:

Section div > Section 类 > section::before 和::after 伪元素。

我继承了我的伪代码,所以当我使用我的前端编辑器更改边框颜色大小等时,伪代码会随之而来。但是,它只影响与其父级相同的边框。我想要做的是让::after pseudo 的 border-right 使用与其 border-bottom 值输入的相同值。

希望这是有道理的。我希望我能用文字更清楚地解释我要追求的目标。如果我需要澄清任何事情,请告诉我。谢谢!

    /* Triangles */
.ss-style-triangles::before,
.ss-style-triangles::after {
    left: 50%;
    width: 50px;
    height: 50px;
    -webkit-transform: translateX(-50%) rotate(45deg);
    transform: translateX(-50%) rotate(45deg);
  border: inherit;
}

.ss-style-triangles::before {
    display: none;
  border: inherit;
  top: -25px;
    background: inherit;
  z-index: -9999;
}

.ss-style-triangles::after {
  border-right: solid 1px;
  bottom: -26px;
    z-index: 0;
    background: inherit;
}

最佳答案

在我自己的代码实验中,这里是

* {
    margin: 0;
    padding: 0;
}

.clearfix {
    padding: 50px;
}

#content {
    width: 100%;
    padding: 10% 0 0;
    background-color: #E8E8E8;
}

#content h1, #content h3 {
    text-align: center;
    color: black;
    font-weight: 100;
    font-family: Segoe UI;
}

#content h1 {
    font-size: 65px;
}

#content h3 {
    font-size: 35px;
    margin-top: 10px;
}

.block-left {
    border-bottom: 1px solid #c00000;
    float: left;
    width: 50%;
}

.block-right {
    border-bottom: 1px solid black;
    float: right;
    width: 50%;
}

.arrow-down {
    border-top: 20px solid #E8E8E8;
    border-bottom: 20px solid transparent;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    width: 0;
    margin: -1px auto;
    position: relative;
    z-index: 1;
}

.arrow-down::before,
.arrow-down::after {
    content: "";
    display: block;
    width: 1px;
    height: 28px;
}

.arrow-down::before {
    background-color: #c00000;
    transform: rotate(-45deg);
    margin-top: -23px;
    margin-left: -10px;
}

.arrow-down::after {
    background-color: #000000;
    transform: rotate(45deg);
    margin-top: -28px;
    margin-left: 9px;
}
<div id="content">
    <h1>What We Offer</h1>
    <h3>We offer many classes to help you build your skills, or to just have fun.</h3>
    <h3>Check out the list below!</h3>
    <div class="clearfix"></div>
    <div class="block-left"></div>
    <div class="block-right"></div>
</div>
<div class="arrow-down"></div>

关于javascript - 在 CSS 中使用 Javascript/jQuery 使 border-right 镜像 border-bottom?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37516121/

相关文章:

javascript - 如何使用 requirejs 正确定义 shim 配置

JavaScript/jQuery : does anybody already created a loading fixed div on top 100%:100% of the page with jquery?

javascript - 两个并排的 CSS 输入

javascript - 为什么我的后端不更新数据库中的关键字数据列

javascript - Bootstrap typeahead 在 MVC 5 中不起作用

javascript - 将 iOS 中被调用函数的结果返回到 JavaScript 中 WkWebView 中的调用函数

javascript - IFrame 中不会发生事件冒泡

jquery - 我的 jquery 产品 slider 有一个灰色的大屁股

html - 使用::after 选择器为按钮设置动画

javascript - 根据变量响应隐藏 div