[英]Left-border on a button doesn't work in CSS
I am trying to display a pipe between two buttons using border-left
property. 我正在尝试使用border-left
属性在两个按钮之间显示管道。 Instead of using a separate div
. 而不是使用单独的div
。
My HTML
is as follows: 我的HTML
如下:
<transition name="fade">
<button class="search-field__submit-button" type="submit">
<img src="search.svg">
</button>
</transition>
<div v-show="searchInput" class="search-field__wrapper">
<button class="search-field__reset-button" type="reset" @click="reset">
<img src="close.svg">
</button>
</div>
My CSS
is as follows: 我的CSS
如下:
.search-field__submit-button {
position: absolute;
top: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
}
.search-field__submit-button:focus {
outline: 1px solid var(--color-blue-active);
}
.search-field__submit-button img {
width: 1.5rem;
height: 1.5rem;
}
.search-field__wrapper {
position: absolute;
top: 0;
right: 4rem;
bottom: 0;
display: flex;
justify-content: center;
}
.search-field__spinner,
.search-field__reset-button {
display: flex;
align-items: center;
}
.search-field__reset-button:focus {
outline: 1px solid var(--color-blue-active);
}
.search-field__reset-button img {
width: 1.5rem;
height: 1.5rem;
}
.search-field__reset-button::after {
border-right: 2rem solid red;
} //this is what I am trying
Tried: Using border-left
for submit_button and also border-right
for the reset_button. 尝试过:对Submit_button使用border-left
border-right
,对reset_button使用border-right
框。 But none of them has worked. 但是它们都没有起作用。 I used ::before
pesudo element. 我在::before
pesudo元素::before
使用了::before
。
Problem: The right border on the reset_button is not visible at all. 问题: reset_button的右边框完全不可见。 Where are things wrong? 哪里错了?
::after
pseudoelement should have content
property to be shown. ::after
伪元素应具有要显示的content
属性。 If you have no need in content, just set it to empty value like that: 如果您不需要内容,则将其设置为空值,如下所示:
.search-field__reset-button::after {
content: '';
border-right: 2rem solid red;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.