Exercise Solution: CSS

These solutions answer the CSS exercises from the jQuery exercise page.

1. Create a Reusable Class Top ↑

.my-p {
    font-family: Arial, sans-serif;
    font-size: 20px;
    background-color: yellow;
}

2. Apply the Same Class to Several Paragraphs Top ↑

<p class="my-p">This is line 1</p>
<p class="my-p">This is line 2</p>
<p class="my-p">This is line 3</p>

3. Move the Rule into a Common CSS File Top ↑

<link rel="stylesheet"
      href="custom.css">

See CSS tutorials.

Original Source Examples Retained for Migration Reference Top ↑

These source-page examples are preserved so no learner-purpose code is silently lost. Use the modern examples above as the recommended implementation.

Original example 1

<p id=p1 class=my_p>This is line 1</p>
<p id=p2 class=my_p>This is line 2</p>
<p id=p3 class=my_p>This is line 3</p>

Original example 2

<style>
.my_p{
	font-size:20px;
	background-color:yellow;
}
</style>

Original example 3

<link rel='stylesheet' href='custom.css' type='text/css'>

Additional Original Learning Routes Top ↑






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer