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
The CSS rule .highlight { background-color: yellow; font-weight: bold; } would apply the following styles to the text within the
with the class "highlight":
- background-color: yellow; This property would set the background color of the text's container (the ) to yellow.
- font-weight: bold; This property would make the text within the container bold.
In summary: The text "This is an important piece of text." would be displayed with a yellow background and in bold font.
You are given the following HTML snippet:
<div class="product">
<h2>Product Name</h2>
<p>Product Description goes here.</p>
<span class="price">£19.99</span>
</div>
Write CSS code to style the price element within the product div to appear in a larger, green font. Use a CSS selector that targets the price element specifically within the product div.
Here's the CSS code to style the price element:
.product .price {
font-size: 20px;
color: green;
}
Explanation:
- .product .price: This CSS selector targets the price element that is a direct descendant of an element with the class product. This ensures that the styling is applied only to the price within the product container.
- font-size: 20px; This sets the font size of the price to 20 pixels, making it larger.
- color: green; This sets the text color of the price to green.
`