ID selector: #header {}
Class selector:. Header {}
Element selector: div {}
Sub-selector: ul > li {}
Descendant selector: div p {}
Pseudo-Class selector: a:hover {}
Property selector: input[type= "text"] {}
ID priority is higher than class classes;
The following styles cover the front;
Higher than the inheritance specified;
Set a cookie with expiration time
var date=new date ();
var d=new Date (Date.settime (Date.gettime () +10000));
The caller in front of togmtstring () must be a time object
Document.cookie= ' name1=haa1;expires= ' + d.togmtstring ();
Document.cookie= ' name2=haa2;expires= ' + d.togmtstring ();
Document.cookie= ' name3=haa3;expires= ' + d.togmtstring ();
Get cookies
var cookie=document.cookie.split (': ');
var value= ';
Cookie.foreach (function (val,index) {
if (val.split (' = ') [0]== ' Name3 ') {
Value=val.split (' = ') [1];
}
});
Console.log (value);
/**
* Delete Cookies
* @type {string}
* @name The name of the cookie to be deleted
* toGMTString () Note: The time format must finally be converted using this method
*/
Document.cookie= ' Name= ""; expires= ' +new Date (). togmtstring ();
CSS basic selector and some code to set cookies