• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
You are here: Home / Archives for selectors

selectors

CSS Display the title attribute with ::after pseudo selector

Title attribute

a::after {
   content: attr(title);
   display: inline-block;
   color: initial;
   font-size: .65em;
   margin-left: 5px;
 }

Href attribute

a::after {
   content: attr(href);
   display: inline-block;
   color: initial;
   font-size: .65em;
   margin-left: 5px;
 }

Filed Under: CSS Tagged With: selectors

CSS Select the first line and first letter

.intro:first-line{
     font-weight: bold;
 }
 .intro:first-letter{
     font-size: 80px;
     color: tomato;
 }

Filed Under: CSS Tagged With: selectors

CSS Select every element except the first or last child

Select every element except the first-child

li:not(:first-child){ }

Select every element except the last-child

li:not(:first-child){ }

Filed Under: CSS Tagged With: selectors

CSS Select the 4th then every 3th element

img{
     float: left;
 }
 img:nth-child(3n+4){
     clear:left;
     border-color: tomato;
 }

Filed Under: CSS Tagged With: selectors

CSS Selector – div:nth-of-type

Select the 4th element of one specific type

div:nth-of-type(4){ }

Filed Under: CSS Tagged With: selectors

CSS Select every 2nd, 3rd element – even / odd

Select every 2nd element

li:nth-child(even){ }
li:nth-child(odd){ }

Select every 3rd element

li:nth-child(3n){ }

Filed Under: CSS Tagged With: selectors

CSS Selectors :only-child, :empty

:only-child

Targets elements with no siblings

CSS

div:only-child {
   color: red;
 }

:empty

Targets elements with no children or content

div:empty {
   background: black;
 }

Filed Under: CSS Tagged With: selectors

CSS UI element states pseudo-classes – :focus, :disabled, :checked

input:focus, textarea:focus {
   border-color: #52bab3;
 }

input:disabled {
   background: #ddd;
 }

input[type="checkbox"]:checked + label {
   font-weight: bold;
 }

Filed Under: CSS Tagged With: selectors

CSS Add SVG icon to every PDF, JPG, ZIP with CSS attribute selectors

Filed Under: CSS Tagged With: selectors

CSS Substring Matching Attribute Selectors

“Begins With” / “Ends With” / “Contains”

Filed Under: CSS Tagged With: selectors

Primary Sidebar

  • angular.io
© 2026 WP Flames - All Right Reserved