Thursday, May 21, 2015

CSS/JQuery - Common Useful Selectors


 “Begins with” Selector – [att^="val"]  
 “Ends with" Selector – [att$="val"]  
 “Contains" Selector – [att*="val"]  
 For example if we wanna find all elements with http:// 
then $('a[href^="http://"]') in jQuery will do the job.

nth-child och nth-last-child.
Means i guess n = random integer and th is some crappy language extension.

CSS Example Reminder: 
$('li:nth-last-child(-n+3)')


li:nth-child(an+b){ }
    a =  represents the number that will be looped, N=2 will loop every second selected element.
    b = Is the startingpoint element where we should begin with this pattern.
    n =  ?

}
Take only the first five in the list:
nth-child(-n+5)
Take only the last 3 in the list:
nth-last-child(-n+3)
jQuery:
 $('li:nth-last-child(-n+3)')

# Bryt text snyggt:
.text-overflow{
 
    white-space:nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
}

No comments:

Post a Comment