CSS Height Width and Max-width
⭐ CSS Height, Width & Max-width (Short Notes)
These properties control the size of an HTML element.
1️⃣ width
Sets how wide an element should be.
You can use px, %, vw, etc.
2️⃣ height
Sets the height of an element.
3️⃣ max-width
Sets the maximum allowed width of an element.
It prevents the element from becoming too wide.
Even if the screen is bigger, the element will not stretch beyond 500px.
📌 Example (All 3 Together)
✔ width: 80% → takes 80% of the screen
✔ max-width: 600px → never grows beyond 600px
✔ height: 150px → fixed height
⭐ Why max-width is useful?
-
Helps make layouts responsive
-
Prevents text from becoming too stretched
-
Improves readability
