gpt4 book ai didi

html - 带有边框半径的css输入 Angular 三 Angular 形标签

转载 作者:搜寻专家 更新时间:2023-10-31 22:54:42 25 4
gpt4 key购买 nike

我想在输入(文本)元素中创建一个三 Angular 形标签,就像这样: input triangle corner with border radius

到目前为止我设法做到的是: input triangle corner without border radius

我怎样才能将这个三 Angular 形“置于”输入边界,让我们这么说,让边界半径不被输入切割这个三 Angular 形的边缘?

这是我的代码:

<div class="input">
<label>email adress</label>
<div class="note">
<p>*</p>
<input type="text" placeholder="Enter your email adress">
</div>
</div>

.input {
display: flex;
flex-direction: column;
width: 100%;
}
.note > input {
width: 515px;
height: 48px;
border-radius: 5px;
border: 1px solid #7d7d7d;
box-shadow:inset 0 0 5px 1px lightgray;
padding-left: 20px;
color: #acacac;
-webkit-color: #acacac;
-moz-color: #acacac;
-ms-color: #acacac;
-o-color: #acacac;
font-size: 16px;
background-color: rgba(211, 211, 211, 0.50);
}

.note > input:focus {
outline: none;
background-color: #f9f9f9;
}

.note {
position: relative;
display: inline-block;
}
.note:after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
display: block;
border-left: 35px solid transparent;
border-bottom: 35px solid transparent;
border-top: 35px solid #0094bb;
}

我想没有办法在不改变其形状的情况下为这个三 Angular 形本身赋予边界半径,对吗?

最佳答案

我为您的 P 标签添加了绝对位置并将其放置在 Angular 落。边框半径是通过将边框半径添加到您的 .note 包装器并设置 overflow:hidden 来实现的。

.note > input {
width: 515px;
height: 48px;
border-radius: 5px;
border: 1px solid #7d7d7d;
box-shadow:inset 0 0 5px 1px lightgray;
padding-left: 20px;
color: #acacac;
-webkit-color: #acacac;
-moz-color: #acacac;
-ms-color: #acacac;
-o-color: #acacac;
font-size: 16px;
background-color: rgba(211, 211, 211, 0.50);
}

.note > input:focus {
outline: none;
background-color: #f9f9f9;
}

.note {
position: relative;
display: inline-block;
border-radius: 5px;
overflow:hidden;
}
.note:after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
display: block;
border-left: 35px solid transparent;
border-bottom: 35px solid transparent;
border-top: 35px solid #0094bb;
z-index:0;

}
.note p{
position: absolute;
right: 5px;
top: 5px;
color:white;
z-index:1;
margin:0;
padding:0;
}

label {
display:block;
}
<div class="input">
<label>email address</label>
<div class="note">
<p>*</p>
<input type="text" placeholder="Enter your email adress">
</div>
</div>

关于html - 带有边框半径的css输入 Angular 三 Angular 形标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47695198/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com