html - 如何在元素底部使用::before 选择器?

标签 html css

我想在我的 div 框底部使用我的::before 选择器(就像在示例图像中一样。我想知道是否有类似::under 选择器的东西?

enter image description here

.direct-chat-text {
    border-radius: 5px;
    position: relative;
    padding: 5px 10px;
    background: #d2d6de;
    border: 1px solid #d2d6de;
    margin: 0px 150px 0 50px;
    color: #444444;
}



.direct-chat-text::before {
    position: absolute;
    right: 100%;
    top: 15px;
    border: solid transparent;
        border-top-width: medium;
        border-right-width: medium;
        border-bottom-width: medium;
        border-left-width: medium;
        border-right-color: transparent;
    border-right-color: #d2d6de;
    content: ' ';
    height: 0;
    width: 0;
    pointer-events: none;
    border-width: 6px;
    margin-top: -6px;
}
<div class="direct-chat-text">3</div>

最佳答案

.direct-chat-text {
    border-radius: 5px;
    position: relative;
    padding: 5px 10px;
    background: #d2d6de;
    border: 1px solid #d2d6de;
    margin: 0px 150px 0 50px;
    color: #444444;
}

.direct-chat-text::before {
    position: absolute;
    right: 10px;
    top: 100%;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #d2d6de;
    content: '';
    pointer-events: none;
}
<div class="direct-chat-text">3</div>

引用(css 形状):https://css-tricks.com/examples/ShapesOfCSS/

关于html - 如何在元素底部使用::before 选择器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44019117/

相关文章:

javascript - 从 responseText 中获取特定的 div 内容并将源代码保存到数据库中

css - img 类标签在 firefox 中无法识别

css - :before pseudo element without moving actual content

javascript - 在同一 View 中单击时动态更改页面

javascript - 当 html 和 body 的高度为 100% 时,ScrollY/ScrollTop 不起作用

html - 并排、居中和响应式制作两个 vimeo 视频

jquery - 每次 div 刷新时不显示加载图像

javascript - 网站加载速度和 Bootstrap "Carousel"图片加载

c# - 如何在 c# asp html 中制作具有 tiles 样式的树?

css - 如何有条件地设置边界半径?