Want every term in a glossary to look alike without styling each one separately? An internal style sheet puts CSS rules inside a <style> element in the HTML page’s <head>. The rules apply to that page. It’s also called an embedded style sheet. section 7.4 section 7.6
Build a rule in three small steps:
- Choose a selector, such as dt, to identify the elements to style. section 7.4
- Put declarations inside braces. Each declaration pairs a property with a value, followed by a semicolon. section 7.4
- Change the rule once to update every matching element on the page. section 7.6
Give glossary terms one look
<head> <style> dt { font-size: 20px; font-weight: bold; } </style> </head> The dt selector targets each <dt> element. Both declarations apply to every matching term, so there’s no need to repeat a style attribute on each one. section 7.4 section 7.6
Internal styles are handy for a single-page site. On a multi-page site, you would have to copy the <style> element to every page and repeat later edits there. An external style sheet avoids that duplication. section 7.6 section 7.7
<style> #1
div { #1
color: red; #1
} #1
</style> #1
<div style="color: blue;"> #2
What is the color of this text?
</div>
What happens when a rule in <style> says red, but an inline style on the same element says blue? In this example, the inline declaration has greater weight, so the text is blue. section 19.26
Try it: add two <dt> elements, give them one internal style rule, then change the font size. Do both terms change together? section 7.4 section 7.6

