In the last article, we learned about CSS display property which helps us to change between inline and block values for different elements. In today's article, we are going to study some more important properties related to width and position of elements.
When and why to use max-width
As we have seen while learning HTML...
The max-width property is used to set the maximum width of an element. All the possible values are same as width property with none as default which means there is no restriction on maximum width.
In the case of above div, if you decrease the width of browser window below specified width then you will get the horizontal scrollbar. If we use max-width instead, the browser will handle small windows properly.
Let's see an example in CSS to do it:
Now let's move to the position property in CSS...
Now let's move to the position property in CSS...
The position property
The position property is used to specify how to position that particular element. The following values can be used for the position property:- static
- relative
- fixed
- absolute
- sticky
Till then #keepCoding.
Comments
Post a Comment