What happens when multiple <style> elements are included in a document?

Styles are applied in the order they appear, with later styles overriding earlier ones if they have equal specificity.

When multiple <style> elements are included in a document, the styles are applied sequentially. If there are conflicting styles with the same specificity, the styles in the later <style> elements will override those in the earlier ones. This order of application is crucial to avoid unexpected styling issues.

In the example below, the paragraph text will be blue because the second style overrides the first.

<style>
  p { color: red; }
</style>
<style>
  p { color: blue; }
</style>
More cards6
Show all