
Have you ever wondered about what makes web pages attractive and visually appealing? You must have seen many appealing and unique web pages and the main thing responsible for making them interactive are various CSS properties.
If you are the one who is not well familiar with these CSS properties, then this article is the right place for you. Read below to learn about various CSS properties and their syntaxes that will help you to make your own unique web page.
| CSS Property | Use |
| color | Used for changing the text color. |
| background-color | Sets the background color of an element. |
| font-size | Adjusts the size of the text. |
| font-family | Changes the style of the font |
| margin | Adds space outside an element. |
| padding | Adds space inside an element, around the content. |
| border | Adds a border around an element. |
| text-align | Align text to the left, center, or right side. |
| width | Sets the width of an element. |
| height | Sets the height of an element. |
| display | Controls how an element is displayed like in a block or inline. |
| CSS Property Example |
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>PW Skills Example Of CSS Properties</title> <style> /* Set the background color of the entire page */ body { background-color: #f0f8ff; font-family: Arial, sans-serif; margin: 0; padding: 0; } /* Style the header */ header { background-color: #4caf50; color: white; text-align: center; padding: 20px; } /* Style the main content section */ main { padding: 20px; margin: 20px; background-color: #ffffff; border: 1px solid #ccc; width: 80%; margin-left: auto; margin-right: auto; } /* Style the main heading */ h1 { font-size: 2em; text-align: center; color: #333; } /* Style the paragraph */ p { font-size: 1.2em; color: #666; text-align: justify; } /* Style an image with a border */ img { display: block; width: 100%; height: auto; margin: 20px auto; border: 5px solid #4caf50; } /* Style the footer */ footer { background-color: #333; color: white; text-align: center; padding: 10px; position: fixed; width: 100%; bottom: 0; } </style> </head> <body> <header> <h1>Welcome to PW Skills Blogs</h1> </header> <main> <h2>About This Page</h2> <p>This is a simple example of how to use various CSS properties to create a nicely styled web page. The page includes a header, a content section, and a footer, all styled with different properties.</p> <h2>Image Example</h2> <img src="PW.jpeg" alt="skills logo"> <p>We have used properties like <strong>color</strong> to change text colors, <strong>background-color</strong> to set the background, <strong>margin</strong> and <strong>padding</strong> to control spacing, and <strong>border</strong> to add borders around elements.</p> </main> <footer> Connect with PW Skills on various social media platorms </footer> </body> </html> |
CSS Properties Example[/caption]