Experiment No 3
Experiment No 3
3. Develop an external style sheet named as “style.css” and provide different styles for h2, h3, hr, p, div,
span, time, img & a tags. Apply different CSS selectors for tags and demonstrate the significance of each.
STYLE.HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<main id="main-content">
<p>This is a paragraph right after an h2. It demonstrates the adjacent sibling selector.</p>
<hr>
<p >This paragraph has a lang attribute, demonstrating the attribute selector.</p>
<section>
</section>
</article>
<p>Check out this <a href=”https://vtu.ac.in/” target=”_blank”>link</a> to see different link states.</p>
</main>
</body>
</html> Style.css
/* Element Selector */
STYLES.CSS
/* Element Selector */ h2 {
color: #2c3e50;
/* Element Selector */ hr {
font-style: italic;
/* Class Selector */
.highlight {
/* ID Selector */ #main-content {
background-color: #ecf0f1;
h2 + p {
}
/* Pseudo-element Selector */ p::first-letter {
color: #3498db;
text-decoration: none;
text-decoration: underline;