CSS text color invariant underline color of the implementation

Source: Internet
Author: User
Tags border color dashed line

Here we have 3 sets of text set three different color underline, respectively, CSS named ". Divcss5-f00", ". divcss5-00f", ". divcss5-333"

Second, the use of CSS border to achieve font underline is solid line or dashed-top

1, font underline color different implementation of the full HTML source code:

 
  
  
  1. <! doctype html> 
  2. <meta  http-equiv= "Content-type"  content= "Text/html; charset=utf-8" &NBSP;/>&NBSP;
  3. <title> Untitled document </TITLE>&NBSP
  4. <style> 
  5. . divcss5-f00{ border-bottom:1px solid   #F00} 
  6. /* css Note:.divcss5-f00  The bottom border of the Settings object is red  */ 
  7. . divcss5-00f{  border-bottom:1px solid  #00F  color: #090} 
  8. /* css Comment Description:. divcss5-00f   Set object bottom border is blue   text is green  */ 
  9. .divcss5-333{ border-bottom:1px solid  #333}  
  10. /* css Comment Description:.divcss5-333  Settings Object Bottom border is black  */ 
  11. </style> 
  12. <body> 
  13. <p> 
  14. DIVCSS5 Practice Text underline color-<span class= "divcss5-f00" > My underline is implemented as red </span> 
  15. & Lt;/p> 
  16. <p> 
  17. DIVCSS5 Practice text underline color-<span class= "divcss5-00f" > My underline is blue, text is green </span> 
  18. </p> 
  19. <p> 
  20. DIVCSS5 Practice Text underline color-<span class= "divcss5-333" > My underline is implemented as black </span> 
  21. </p> 
  22. </body> 

Through the above Div+css example, we can learn to use the Border-bottom style to the text font set under the border color to achieve the lower border color style changes, so that the underline color control effect. We have to realize that the text-decoration underline color changes with the color of the text, in other words, using the Text-decoration property to achieve the underline color and text color is synchronized, what color text, text underline what color, To change the color of the text and underline text, we can use the Border-bottom border style.

2, the use of CSS border to achieve font underline for solid line or dashed-top

In addition to using the Border-bottom bottom border style to change the color of the bottom border of an object to an ever-changing color effect, you can also achieve an underscore solid or dashed line effect by setting a solid line (solid) or a dash (dashed) on the CSS bottom border style.

Next we css+div instance practice using Border-bottom to implement the text underline color and dotted line changes.

1, CSS div instance complete HTML source code is as follows

 
  
  
  1. <! doctype html> 
  2. <meta  http-equiv= "Content-type"  content= "Text/html; charset=utf-8" &NBSP;/>&NBSP;
  3. <title> Underline each style   online demo  www.divcss5.com</title> 
  4. <style> 
  5. . divcss-aa{  border-bottom:1px dashed  #F00  color: #0FF} 
  6. /*  Sets the object. Divcss-aa the bottom border is dashed red, and the CSS font color is sky-blue  */ 
  7. . divcss-bb{ border-bottom:1px solid # 00f; color: #090} 
  8. /*  set object. DIVCSS-BB Bottom border is solid blue, Object div font color is green  */ 
  9. </ style> 
  10. <body> 
  11. <p> 
  12. use bottom border to implement Font underline various style effects, <span class= "DIVCSS-AA" > I underline is dashed red, the font is sky-blue </span> 
  13. <!--  HTML Annotation Description: Implement text font underline to red dotted line, the font is sky-blue  --> 
  14. </p> 
  15. <p> .
  16. use the bottom border to implement font underline various style effects, <span class= "DIVCSS-BB" > I underline is solid line blue, font is green </span> 
  17. <!--  Implement text font underline is blue solid line, the font is green  --> 
  18. </p> 
  19. </body> 

Why use the span tag without the DIV tag to set the text object CSS style, you can go into the div and span differences to understand.

Summary: By using border styles to achieve a variety of underscores.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.