Open monarosej opened 1 month ago
CSS (Cascading Style Sheets) is used to style the layout of web pages. It controls how HTML elements are displayed, including colors, fonts, and spacing.
To create CSS code, you can:
.css
) and link it to the HTML using the <link>
tag in the <head>
.-- Here's an example of an external CSS :
-- And this is how you can create the css code aka syntax
body { background-color: lightblue; }
h1 { color: navy; font-family: Arial, sans-serif; }
Good job!!
Textual comments in CSS style sheets are similar to those in the C programming language.
body { font-size: 62.5% / 1em = 10px / }
The stuff inside the/ / marks are CSS comments.
Embedded styles are placed within the head element and use the style element. Embedded styles affect every instance of the element specified.
Inline styles, as you may have guessed, are placed inside elements within the body of an HTML document. Using the attribute "style", any element can be affected.
A style sheet gives the user several benefits:
CSS has the ability to explicitly control the status of underlining for an element - even for hyperlinks.
The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#".