Created
August 12, 2020 20:56
-
-
Save kushalseth/dfa9c1975ad091a9a25f5148cd7af88e to your computer and use it in GitHub Desktop.
CSS Cascading example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
div p { | |
background-color: #ffff00; // yellow | |
} | |
p { | |
background-color: #ff0000; // red | |
} | |
p.abc-myclass { | |
background-color: #ffa500; // orange | |
} | |
</style> | |
</head> | |
<body> | |
<h1>This is h1 directly under body</h1> | |
<p class="abc-myclass"> Test class attribute para </p> | |
<div> | |
<h2>I am h2 directly under div</h2> | |
<p data-test="001">This is para inside div, but not directly inside div</p> | |
</div> | |
<div> | |
<p class="abc-myclass">This is para directly inside div</p> | |
<span><p>This is para inside span</p></span> | |
</div> | |
<p class="myclass" data-test="001">I am paragraph directly inside the body and below a div</p> | |
<a href="github.com/kushalseth" target="_blank">GIT rofile</p> | |
</body> | |
</html> |
Author
kushalseth
commented
Aug 12, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment