CSS height - height property
The CSS height property, as the name implies, is a standard property used to control the height of web elements. Web designers often use the CSS height property to adjust the height of the DIV block , the height of the image, the height of the table or the height of the text input field. , These height attributes can be adjusted by numbers and units to determine the final height to be displayed. The CSS height attribute is often used in conjunction with the width attribute for design width . All our commonly used mainstream browsers support the effect of the CSS height attribute. In addition, CSS has also introduced more advanced min-height and max-height attributes to increase the flexibility of the design of the height of web page elements.
CSS height height attribute syntax
CSS height height property parameter value
Width value | grammar | Description |
auto | height:auto; | Let the browser automatically determine the height of web page elements. |
length | height: number + unit; | Acceptable units are px, em, cm and other web standard units. |
% | height:number%; | Use percentages to set the height of web page elements, you need a reference for comparison. |
inherit | height:inherit; | The height attribute value inherited from the parent layer. |
CSS height property example 1: adjust the height of the DIV block
<div style="border:1px green solid;height:100px;">This is setting the height attribute Height of 100px</div>
Reference materials: How to use CSS border and CSS DIV block tags.
Example of CSS height property 2. Adjust the height of table fields
<tr><td>Default table field height</td></tr>
<tr><td style="height:100px;">The field adjusted by the height attribute Height</td></tr>
</table>
Default table column height |
The height of the field after adjusting the height property |
Reference material: HTML table
CSS height attribute example 3. Adjust the height of the picture
修改圖片:<img src="upload/20141007145509.png" style="height:120px;">

Modify picture:

Reference: HTML img picture tag
Post a Comment
0 Comments