Custom size attributes in CSS


In the previous CSS lesson Taimienphi.vn introduced you to the Outline property in CSS, in the next lesson below, Taimienphi.vn will introduce you to the custom size attributes in CSS.


The Custom size attributes in CSS Used to control the height and width of an element. Refer to the following CSS lesson of Taimienphi.vn to learn the details of custom size attributes in CSS.

Custom size attributes in CSS

Table of Contents:
1. Custom size attributes in CSS
1.1. Width and height attributes in CSS
1.2. Max-height attribute
1.3. Properties min-height
1.4. Max-width attribute
1.5. The min-width attribute

1.Size custom attributes in CSS

By using properties width, height, max-width and max-height, … in CSS to control the size of the element.

1.1. Width and height attributes in CSS

Properties width and Cao defines the content area width and height of the element. This width and height do not include padding, borders and margins.

These properties can take values ​​by length (px, pt, em, …), percentages (%) or keywords auto (keyword auto).

Note: The width and height attributes do not take negative values.

For example:

medication is exactly the same in css

The output will look like the following:

medication under the control of css 2

1.2. Max-height attribute

Properties max-height Allows you to specify the maximum height for the content in the frame. This maximum height does not include padding, borders (margin) and margins (margin).

Element to apply attribute max-height Never be higher than the specified value, even if the attribute value Cao is set larger. For example, if the height attribute value is set to 200px and max-height is set to 100px, the actual height of the element is 100px.

For example:

medication under the influence of css 3

The output will look like the following:

smoking with drugs in css 4

Properties max-height often used with the same attribute min-height to calculate the average height of the relevant element.

1.3. Properties min-height

Use properties min-height to specify the minimum height for the content in the frame. This minimum height does not include padding, borders (margin) and margins (margin).

Element applied min-height Never smaller than the specified minimum height. For example if Cao is set to 200px and min-height is set to 300px, the actual height of the element is 300px.

For example:

smoking with drugs in css 5

The output will look like the following:

smoking with drugs in css 6

Properties min-height often used with the same attribute max-height to calculate the average height of the relevant element.

1.4. Max-width attribute

Properties max-width Allows you to specify the maximum width for the content in the frame. This maximum width does not include padding, borders (margin) and margins (margin).

Element to apply attribute max-width Never be wider than the specified value, even if the attribute value width is set larger. For example, if the width attribute value is set to 300px and max-width is set to 200px, the actual height of the element is 200px.

For example:

medication under the influence of css 7

The output will look like the following:

medication under the influence of css 8

Properties max-width often used with the same attribute min-width to calculate the average width of the relevant element.

1.5. The min-width attribute

Use properties min-width to specify the minimum width for the content in the frame. This minimum width does not include padding, borders and margins.

Element applied min-width Never smaller than the specified minimum height. For example if width is set to 300px and min-width is set to 400px, the actual height of the element is 400px.

For example:

smoking with drugs in css 9

The output will look like the following:

medication under the form of css 10

https://thuthuat.taimienphi.vn/thuoc-tinh-tuy-chinh-kich-thuoc-in-css-50607n.aspx
The lesson above Taimienphi.vn has just introduced you to custom size properties in CSS. In the next lesson, Taimienphi.vn will introduce you further Scrollbar in CSS Please.

.

Add a Comment

Your email address will not be published. Required fields are marked *