CSS- Additional Pseudo-Classes
How do I make an css- additional pseudo-classes?
CSS Pseudo-Classes covered: :root :target :empty :not(). What is a css- additional pseudo-classes? How do you make a css- additional pseudo-classes? This script and codes were developed by Anthony Albertorio on 24 September 2022, Saturday.
CSS- Additional Pseudo-Classes - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS- Additional Pseudo-Classes</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <ul> <li><a href="#s1">Target Section 1</a></li> <li><a href="#s2">Target Section 2</a></li> <li><a href="#s3">Target Section 3</a></li>
</ul>
<div id="s1"> <h2>Section 1</h2> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in.
</div>
<div id="s2"> <h2>Section 2</h2> Integer laoreet urna ut est cursus nec tristique elit vestibulum. In hac habitasse platea dictumst. Quisque pharetra odio nec urna lobortis sed ultrices dolor posuere. Sed nec nisl id augue congue euismod. Nullam elementum quam vitae lectus consequat eu faucibus odio iaculis. Nunc at turpis nibh, posuere faucibus ligula.
</div>
<div id="s3"> <h2>Section 3</h2> Sed ullamcorper posuere accumsan. Maecenas in varius libero. Morbi elementum nisi orci, adipiscing venenatis odio accumsan vel. Aliquam pretium velit sapien, non pulvinar nisi faucibus sit amet. Curabitur eu ligula vel est dictum euismod. Pellentesque suscipit commodo odio non eleifend.
</div>
<!--empty div element -->
<div></div>
</body>
</html>
CSS- Additional Pseudo-Classes - Script Codes CSS Codes
/* General Styling*/
body { font: normal 1.1em/1.5 sans-serif; padding: 0 22%;
}
ul { line-height: 2.1em; list-style-type: none; padding-left: 20px;
}
h2 { margin-top: 0;
}
div { margin-bottom: 12px; padding: 20px;
}
/*Pseudo-classes*/
/* :root pseudo-class selects element that is the root of the document.
In this case, its the element
Why use :root? Because it has more specificity than HTML type selector.
*/
:root { background-color: #e0eef5;
}
/* :target pseudo class- Allows us to target elements based on the url; so if the elements id matches the hash in the url.
An example is the click back to top link that takes you the top of the same page.*/
/*Pretty handy when reading and looking to highlight sectiont that you are on*/
:target { color: limegreen; background-color: tomato;
}
/* :empty pseudo class- targets elements that have no child elements or content what so ever; target empty elements.
*/
/* A good use for this would be a results field (in say a form) that returns empty or with no content. We can use it to warn the user that no results were found or returned.
*/
:empty { background-color: tomato;
}
/* :not(){} -negation pseudo-class.
It selects everything except the element that we specifiy.
We can use it with just about any type of
In this case, targets all the div elements that are not empty*/
/*
div:not(:empty) { background-color: lightyellow;
}
*/
/*targest all divs except the with the attribute id=s2
pretty cool!*/
div:not([id="s2"]){ background-color: lightyellow;
}
Developer | Anthony Albertorio |
Username | tesla809 |
Uploaded | September 24, 2022 |
Rating | 3 |
Size | 2,690 Kb |
Views | 14,168 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Tic Tac Toe | 4,263 Kb |
CSS- UI Element States Pseudo-Classes | 2,206 Kb |
FreeCodeCamp-Tribute Page | 1,896 Kb |
A Pen by Anthony Albertorio | 23,123 Kb |
Weather App | 2,717 Kb |
FreeCodeCamp-Tribute Page on Ethereum | 2,809 Kb |
CSS- Relative Length Units | 1,694 Kb |
Million-token-HomePage-initial-mockup | 9,938 Kb |
CSS Combinators | 1,957 Kb |
Famo.us test | 1,753 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Ionic Infinite outside ion-content with ion-pane | Felquis | 3,117 Kb |
Disable JavaScript execution from console | Ludviglindblom | 2,534 Kb |
Feedback Page | TessDiNapoli | 2,836 Kb |
A Pen by Dalton Liu | Liudalton | 12,437 Kb |
Simple checkbox style | Vncnz | 2,628 Kb |
Apple website | Jds317 | 1,835 Kb |
Banner Ad | Raquellorenzana | 4,172 Kb |
Nested table email layout | Massimo-cassandro | 2,355 Kb |
Octopus Bar iPad App Interactions | Davidkpiano | 6,735 Kb |
Day 1 - Portfolio | Chpecson | 3,532 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!