The underline length can be set in css by using the width and "border-bottom" attributes; you only need to add "text element" to the text element {width: underline length value; border-bottom: underline thickness solid underline color ;" style is enough.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
Can the length of the underline style in css be set?
Yes.
In CSS, you can set the underline of a text element by setting the lower border of the text element. You only need to set the width of the text element through the width element, that is, set the underline of the text element.
The example is as follows:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style type="text/css"> .token1 { width: 100px; border-bottom: 1px solid black; } .token2 { width: 200px; border-bottom: 1px solid black; } </style> </head> <body> <div class="token1">下划线</div> <div class="token2">下划线</div> </body> </html>
Output result:
(Learning video sharing: css video tutorial)
The above is the detailed content of Can the length of underline style be set in css?. For more information, please follow other related articles on the PHP Chinese website!