Introduction to External CSS Styling
Introduction to External CSS Styling
To use an external CSS file, we need to create a .css file and link it to our HTML document
using the following code inside the <head> section:
This tells the browser to use the styles.css file for styling the webpage.
body {
background-color: lightblue;
}
h1 {
font-family: 'Arial', sans-serif;
color: darkblue;
font-size: 32px;
}
4. Styling Paragraph Text
p{
font-weight: bold; /* Makes text bold */
font-style: italic; /* Makes text italic */
}
ul {
list-style-type: square; /* Custom bullet shape */
}
li {
border: 1px solid black; /* Adds a border around each item */
padding: 5px;
}
6. Styling an Image
img {
width: 300px; /* Adjusts the width */
border: 2px solid black; /* Adds a small border */
}
a:hover {
color: red;
}
This changes the link color to red when the mouse is over it.
8. Styling the Footer
footer {
text-align: center; /* Centers text */
color: gray; /* Changes text color */
}