CSS Properties: How to set the height and width of a paragraph?
Solution:
HTML Code:
Explanation:>
- This HTML document demonstrates how to set the height and width of elements using CSS classes.
- CSS comments are added to explain each section of the code.
- Two CSS classes are defined: normal and w3r.
- The normal class sets the height to auto, allowing the element to adjust its height based on content.
- The w3r class sets both the height and width of elements to 100 pixels.
- An image and a paragraph are used to demonstrate the application of these CSS classes.
Live Demo:
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | No |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.