gpt4 book ai didi

c# - 为一个元素设置样式表

转载 作者:太空宇宙 更新时间:2023-11-03 18:10:08 25 4
gpt4 key购买 nike

我有一个 web 用户控件的样式,我将它放在母版页的表单元素中。但是 webuser 控件的样式表会影响内容占位符中的所有其他元素。

这是发生的事情的图片: enter image description here

* { box-sizing: border-box; padding:0;}

body {
background: #333 url(../images/bg.jpg) repeat top left;
font-family: Arial;
color:white;
font-size:12px;

}

form {
background:#111;
width:300px;
margin:30px auto;
border-radius:0.4em;
border:1px solid #191919;
overflow:hidden;
position:relative;
box-shadow: 0 5px 10px 5px rgba(0,0,0,0.2);
}


.inset {
padding:20px;
border-top:1px solid #19191a;
}

form h1 {
font-size:18px;
text-shadow:0 1px 0 black;
text-align:center;
padding:15px 0;
border-bottom:1px solid rgba(0,0,0,1);
position:relative;
}

input[type=text],
input[type=password] {
width:100%;
padding:8px 5px;
background:linear-gradient(#1f2124, #27292c);
border:1px solid #222;
box-shadow:
0 1px 0 rgba(255,255,255,0.1);
border-radius:0.3em;
margin-bottom:20px;
}

label[for=remember]{
color:white;
display:inline-block;
padding-bottom:0;
padding-top:5px;
}

input[type=checkbox] {
display:inline-block;
vertical-align:top;
}


input[type=submit] {
padding:5px 20px;
border:1px solid rgba(0,0,0,0.4);
text-shadow:0 -1px 0 rgba(0,0,0,0.4);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 10px 10px rgba(255,255,255,0.1);
border-radius:0.3em;
background:#0184ff;
color:white;
float:right;
font-weight:bold;
cursor:pointer;
font-size:13px;
}

input[type=submit]:hover {
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 -10px 10px rgba(255,255,255,0.1);
}

input[type=text]:hover,
input[type=password]:hover,
label:hover ~ input[type=text],
label:hover ~ input[type=password] {
background:#27292c;
}

最佳答案

您可以通过 html 代码将类或 Id 添加到要覆盖的特定控件,并为此编写单独的 css,例如:

<form class="form-class"></form>

.form-class{
background:#FFF;
width:500px;
margin:30px auto;
border-radius:0.4em;
border:1px solid #191919;
overflow:hidden;
position:relative;
box-shadow: 0 5px 10px 5px rgba(0,0,0,0.2);
}

然后检查您的输出,它仍然显示相同的结果,然后您已将 important 添加到所需的属性中,例如:

.form-class{
background:#FFF !important;
width:500px !important;
margin:30px auto;
border-radius:0.4em;
border:1px solid #191919;
overflow:hidden;
position:relative;
box-shadow: 0 5px 10px 5px rgba(0,0,0,0.2);
}

这将帮助您覆盖 html Controller 上的特定 css。

关于c# - 为一个元素设置样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23882456/

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