简体   繁体   English

如何为字段集边框创建背景色

[英]how to create background color for fieldset border

I am new to HTML. 我是HTML的新手。 so, i had a doubt how to create a background color or image for field set border? 因此,我怀疑如何为字段设置边框创建背景颜色或图像? can i able to use the normal color values for field set or any special color codes are needed for creating background color in field set? 我可以使用字段集的正常颜色值还是需要任何特殊的颜色代码来在字段集中创建背景颜色? any information will be helpful. 任何信息都会有所帮助。 i already have a background image for the HTML and i want to apply a background color to the field set border. 我已经有HTML的背景图片,并且我想将背景颜色应用于字段集边框。

fieldset { border-color:black; fieldset {border-color:black; border-style: solid; 边框样式:实心; } }

JSfiddle JS小提琴

fieldset {
  background-color: black;
  color: white;
}

you can use this 你可以用这个

.field_set{
border-color:#F00; //your color here
border-style: solid; //border style
}

You can also specify other css properties here as normal css styling 您还可以在此处将其他CSS属性指定为常规CSS样式

In your CSS code, add: 在您的CSS代码中,添加:

fieldset {
    border: solid red;
}

This will make the borders of the <fieldset> red . 这将使<fieldset>的边框<fieldset> red Most standard colors are supported. 支持大多数标准颜色。 You can also use hexadecimal values, such as #FF0000 , which is also red. 您还可以使用十六进制值,例如#FF0000 ,它也是红色。 The first two hexadecimal numbers are the red component, the middle two are the green component, and the last two are the blue component. 前两个十六进制数字是红色分量,中间两个是绿色分量,后两个是蓝色分量。

To insert an image background, use: 要插入图像背景,请使用:

fieldset {
    background-image: url('background.png');
}

CSS code can be be stored in a file (for example, style.css ) and included in the <head> of a HTML document, like this: CSS代码可以存储在文件中(例如style.css ),并可以包含在HTML文档的<head>中,如下所示:

<link rel="stylesheet" type="text/css" href="style.css"></link>

Or directly in your HTML like so: 或直接在您的HTML中像这样:

<style>
    /* CSS Code here */
</style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM