Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the color of the CSS border

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to set the color of CSS border". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how to set the color of CSS border"!

Configuring border colors is especially easy. CSS uses an easy border-color attribute that can suffer up to 4 color values at once.

Any type of color value can be applied, e.g. named colors, hexadecimal and RGB values:

p { border-style: solid; border-color: blue rgb(25%,35%,45%) #909090 red; }

If the color value is less than 4, value duplication will work. For example, the upper and lower borders of the sound consciousness paragraph below are blue, and the left and right side frames are red:

p { border-style: solid; border-color: blue red; }

Comment: The default border tone is the element's own foreground. If you do not declare a color for a border, it will be identical to the text color of the element. On the other hand, if the element does not have any text, if it is a table containing only images, then the border color of the table is the text color of its parent element (because color can be inherited). This parent element is probably a body, div, or another table.

Define unilateral color

There are also some single-sided border color attributes. Their reasoning communicates with unilateral names and width attributes:

border-top-color

border-right-color

border-bottom-color

border-left-color

To specify a solid black border for the h2 element and a solid red border for the right, you can specify:

h2 { border-style: solid; border-color: black; border-right-color: red; } Bright border

As we said earlier, if borders don't have style, they don't have width. However, in some cases you may wish to set up a non-standard border.

CSS2 introduces the border color value transparent. This value is used to create an unbiased border with width. Consider the following example:

AAABBBCCC

We defined the following colors for the links below:

a:link, a:visited { border-style: solid; border-width: 5px; border-color: transparent;}a:hover {border-color: gray;} At this point, I believe that everyone has a deeper understanding of "how to set the color of CSS border". Let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report