How to add borders to text with css: First create an HTML sample file; then define the text content in the body; and finally add borders to the text through the "border: medium solid red" style.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
css adds borders to text:
CSS can perform pixel-level precise control of the layout of element positions in web pages, supports almost all font sizes and styles, and has the ability to control web pages Object and model style editing capabilities.
Let’s take a look at how to use css to add borders to text:
css can add borders to text through the border attribute.
The border abbreviation attribute is set in one statement. border properties.
The following attributes can be set in order:
border-width border-style border-color
Attribute value:
border-width specifies the width of the border.
border-style specifies the style of the border.
border-color specifies the color of the border.
inherit specifies that the setting of the border attribute should be inherited from the parent element.
Example:
<html> <head> <style type="text/css"> p { border: medium solid red } </style> </head> <body> <p>文字边框</p> </body> </html>
Rendering:
[Recommended learning: css video tutorial]
The above is the detailed content of How to add borders to text in css. For more information, please follow other related articles on the PHP Chinese website!