Information Communication Technology ICT – 21 Website authoring | e-Consult
21 Website authoring (1 questions)
Login to see all questions.
Click on a question to view the answer
HTML Code:
<style>
.animal-entry {
background-color: lightblue;
font-family: Arial;
font-size: 12px;
width: 400px; /* Example fixed width */
}
</style>
This is an example of a Lion.
The Lion is a majestic creature.
Explanation:
- <style> block: This section contains the CSS rules for the class.
- .animal-entry { ... } : This defines a CSS class named 'animal-entry'.
- background-color: lightblue; : Sets the background colour of any element with the class to light blue.
- font-family: Arial; : Sets the font to Arial.
- font-size: 12px; : Sets the font size to 12 pixels.
- width: 400px; : Sets the width of the element to 400 pixels.
- Applying the class: The class 'animal-entry' is applied to the <p> elements using the 'class' attribute. This ensures that all the <p> elements with this class will inherit the defined styles.