pre { color: #333; font-family: monospace; font-size: 1.2rem; background-color: #f8f8f8; padding: 1rem; border: 1px solid #dedede; border-radius: 5px; overflow-x: auto; } p { font-size: 1.2rem; line-height: 1.5; }
在网页设计中,文本框也是非常重要的一个元素。它可以用于用户注册、登陆、留言等功能中,用户可以在文本框中输入内容。
而在css中,我们可以针对文本框进行样式的改变,包括修改文本框的边框、背景、字体、大小等等。
下面是一些常用的文本框样式:
/*去除默认样式*/
input {
border: none;
outline: none;
background-color: transparent;
}
/*设置边框样式*/
input[type=text] {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
}
/*设置背景颜色和字体颜色*/
input[type=password] {
background-color: #f7f7f7;
color: #333;
border: 1px solid #e5e5e5;
border-radius: 5px;
padding: 10px;
}
/*调整字体大小*/
input[type=number] {
font-size: 1.2rem;
border: 1px solid #eee;
padding: 8px;
border-radius: 5px;
}
通过上述代码可以看出,可以通过css的style属性来修改文本框的样式。我们可以根据实际需求,设置边框、背景、字体等样式,以此来让文本框更加美观。
总之,文本框是一个非常重要的元素,在网页设计中占用很大的比重。通过修改文本框的样式,可以让页面更加美观、清爽,给用户留下更好的印象。