Page 183 - Computer Software Application TP - Volume 1
P. 183
COMPUTER SOFTWARE APPLICATION - CITS
}
`;
// Set the CSS rules to the style element
styleElement.innerHTML = cssRules;
// Append the style element to the document’s head
document.head.appendChild(styleElement);
</script>
</body>
</html>
3 Save the program as a .html file
4 Open the html file with a web browser
5 Verify the output.
1 Style all <h1> elements on a webpage to have a font size of 24px and be displayed in bold by using CSS
element Selector.
2 Apply a background color of yellow to all <div> elements with the class container by using CSS element
Selector.
3 Style the font size of an element to be 24px and bold by using its id.
4 Style all elements with the class “btn” to have a background color of blue and white text color using CSS.
5 Style the color of all text on the webpage to be black using the universal selector.
6 Set the text alignment to center for all <h1>, <h2>, and <h3> elements on the webpage by using CSS group
Selector.
7 Create an external stylesheet and link to an HTML document and apply different style to elements.
8 Provide an example of how an inline CSS is applied to an HTML element.
168
CITS : IT & ITES - Computer Software Application - Exercise 44