Search
 
SCRIPT & CODE EXAMPLE
 

CSS

css cheat sheet

Best CSS cheat Sheet:
https://htmlcheatsheet.com/css/
Comment

css cheat sheet

The best css cheat sheet - https://htmlcheatsheet.com/css/
Comment

CSS Selectors Cheat Sheet

/*---- Ultimate CSS Selectors Cheat Sheet ----*/

Tag Selector - h1{},h2{},body{},p{},div{}

ID Selector -  #my_id{}

Class Selector - .my_class{}

Grouping the CSS Selectors -  #my_id, p {}
	- multiple elements will have the same styling

Universal Selector - *{}

Specific Class Selector -     h1.my_class {}
	- select only a particular element rather than all with the same class

/****CSS Combinator Selectors****/

Descendant Selector -   div p {}
	- separating two elements with space where the second element is required to be the descendant of the first element.	
	- relationship “descendant” symbolises that the element should be inside another element (before the first element tag has been closed).

Child Selector -  div > h3 {}
	- the second element should be a child of the first element
	- child selector is defined with the “>” symbol which symbolizes that the second element is the child of the first element

Adjacent Sibling Selector -  div + h3 {}
	- All the other elements sequences are ignored, and only the directly followed element is considered.
	- following example, we check for the adjacent “h3” tag inside the “div” tag.

General Sibling Selector -  div ~ h3 {}
	- CSS general sibling selector selects all the siblings

Pseudo-Class Selectors - a:visited, a:hover, a:active, li:first-child

Pseudo Element Selectors -  p::selection{},  p::before{},  p::after{}



/***********Attribute Selectors **********/
Requires just the attribute name in the parameters

- p[lang]{}
	- following code performs CSS styling on the “p” elements that have the “lang” attribute:
 
CSS [Attribute = Value] Selector   - p[lang = "hi"]{}
	- only the attribute “lang” with a value “hi” is selected

CSS [Attribute ~= “Value”] Selector - p[title ~= "shirt"]{}
	- select the element if it includes the word “value” in the attribute specified

CSS [attribute |= “value”] Selector  -   p[title |= "shirt"]{}
	- selects all those attribute values that start with the word “value”
	- selector works only when the value is either a single word in the attribute such as only “shirt” or is hyphenated as “shirt-blue”. White space in between will not be selected by the CSS for styling. The value has to be one word.

CSS [attribute ^= “value”] Selector -  p[title ^= "shirt"]{}
	- Any value that starts with the word “value” will be selected for styling

CSS [attribute $= “value”] Selector  -  p[title $= "shirt"]{}
	- the $ attribute selector finds the ending with the word “value”

CSS [attribute *= “value”] Selector -  p[title *= "rt"]{}
	- selector works like the regular expression checker which selects every element with the target attribute having value composed of “value”.
	-  The value need not be a whole word. The selector works even if the “value” is a part of the attribute value.
Comment

PREVIOUS NEXT
Code Example
Css :: before and after pseudo selectors 
Css :: chai assert 
Css :: css image responsive on screen zoom 
Css :: css footer always at bottom but visible 
Css :: background image causes webpage scrolling slow 
Css :: letter spacing text 
Css :: test typescript 
Css :: secltor for parent li css 
Css :: create variable in css 
Css :: como hacer que me queden los nombres dentro de un formulario css 
Css :: print to pdf setting css for A4 size 
Css :: display: inline; 
Css :: change the background of an element in a loop using css 
Css :: css apply style to direct children 
Css :: css preloader, preload website screen 
Css :: fluorescent blue hex code 
Css :: scss loop 
Css :: ohmyzsh shortcut to oepn folder with vscode 
Css :: css clip-path 
Css :: otp input next field html css 
Css :: hover bg change 
Css :: restore mariadb from bz2 file cli 
Css :: css template 
Css :: blurring behind a div 
Css :: animation 
Css :: home page css 
Css :: test two css 
Css :: Methods in Golang 
Css :: tailwind css symfony 
Css :: adding custom icons 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =