Home>Article>Web Front-end> How to set the width of td with css
In CSS, you can use the width attribute to set the td width. You only need to set the "width:width value;" style to the td element. The width attribute sets the width of an element, which defines the width of the element's content area, excluding padding, borders, or margins.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
Define a tableb table
商品 | 价格 |
---|---|
T恤 | ¥100 |
牛仔褂 | ¥250 |
牛仔库 | ¥150 |
##How to set the width of td using css?
You can use the width attribute to set the td width, syntax:td{ width:100px; }Rendering: (Learning video sharing:
css video tutorial)
Instructions: The
width attribute sets the width of the element. Note: The width attribute does not include padding, borders and margins! Attribute value:Description | |
---|---|
default value. The browser can calculate the actual width. | |
length | Use px, cm and other units to define the width.|
% | Defines the width as a percentage based on the width of the containing block (parent element).|
Specifies that the value of the width attribute should be inherited from the parent element. |
Introduction to Programming! !
The above is the detailed content of How to set the width of td with css. For more information, please follow other related articles on the PHP Chinese website!