Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.
CSS is designed to enable the separation of content and presentation, including layout, colors, and fonts. This separation can improve content accessibility; provide more flexibility and control in the specification of presentation characteristics; enable multiple web pages to share formatting by specifying the relevant CSS in a separate .css file, which reduces complexity and repetition in the structural content; and enable the .css file to be cached to improve the page load speed between the pages that share the file and its formatting. — Wikipedia
Frequently Used Words in CSS Classes
Images
image
,img
,picture
,pic
— imageicon
— iconlogo
— logouserpic
,avatar
— user picture, small user imagethumbnail
,thumb
— thumbnail, a smaller version of an image
Text
title
,subject
,heading
,headline
,caption
— titlesubtitle
— subtitleslogan
— sloganlead
,tagline
— lead paragraph in the texttext
— textual contentdesc
— description, a variation of textual contentexcerpt
— text excerpt, usually used before a “Read More…” linkquote
,blockquote
— quotesnippet
— code examplelink
— linkcopyright
,copy
— copyright
Lists
list
,items
— listitem
— list item
Blocks
page
— root element of the pageheader
— header (of a page or an element)footer
— footer (of a page or an element)section
— section of content (one of several)main
,body
— main part (of a page or an element)content
— content of an elementsidebar
— sidebar (of a page or an element)aside
— block with additional informationwidget
— widget, for example, in a sidebar
Layout
wrapper
,wrap
— wrapper, usually outerinner
— inner wrappercontainer
,holder
,box
— containergrid
— layout (of a page or an element) as a grid (usually containsrow
andcol
)row
— container as a rowcol
,column
— container as a column
Controls
button
,btn
— button, for example, for submitting a formcontrol
— control element, for example, forward/backward arrows in a photo gallery, slider control buttonsdropdown
— dropdown list
Media Queries
phone
,mobile
— mobile devicesphablet
— large screen phones (6-7”)tablet
— tabletsnotebook
,laptop
— laptopsdesktop
— desktop computers
Sizes
tiny
,xs
— tiny, extra smallsmall
,sm
— smallmedium
,base
— mediumbig
,large
,lg
— largehuge
,xl
— huge, extra largenarrow
— narrowwide
— wide
Miscellaneous
search
— searchsocials
— block of social media iconsadvertisement
,adv
,commercial
,promo
— advertisement block (AdBlock usually hides them, it’s not recommended to use these classes for internal ads)features
,benefits
— list of main features of a product or serviceslider
,carousel
— slider, an interactive element with scrolling contentpagination
— paginationuser
,author
— user, author of a post or commentmeta
— block with additional information, for example, a block of tags and dates in a postcart
,basket
— shopping cartbreadcrumbs
— navigation trail (“breadcrumbs”)more
,all
— link to full informationmodal
— modal (dialog) windowpopup
— popup windowtooltip
,tip
— tooltippreview
— preview, excerpt, for example, news or a post, can consist of title, description and image. It’s meant to link to the full version.overlay
— overlaying layer, for example, to darken images or create modal windows
States
active
,current
— active element, for example, the current menu itemvisible
— visible elementhidden
— hidden elementerror
— error statuswarning
— warning statussuccess
— successful task completion statuspending
— pending state, for example, before changing the status to error or success
Examples of Use
Examples with BEM metodology.
Simple List
<ul class="list">
<li class="item">First</li>
<li class="item">Second</li>
<li class="item">Third</li>
</ul>
User Picture (Userpic)
<div class="user">
<img class="user__img" src="userpic.png" alt="Dormidont Petrovich">
<a class="user__link" href="#">Dormidont Petrovich</a>
</div>
Gallery
<div class="gallery">
<ul class="gallery__list">
<li class="gallery__item">
<img class="gallery__img" src="flowers.jpg" alt="Blooming like there's no tomorrow">
</li>
<li class="gallery__item">
<img class="gallery__img" src="trees.jpg" alt="Park 'Three Pines'">
</li>
</ul>
</div>
Navigation
<nav class="nav">
<a class="nav__link nav__link_active">Home</a>
<a class="nav__link" href="#">Secondary</a>
<a class="nav__link" href="#">Third from the End</a>
<a class="nav__link" href="#">Penultimate</a>
<a class="nav__link" href="#">Absolute End</a>
</nav>
<nav class="nav">
<ul class="nav__list">
<li class="nav__item nav__item_current">
<a class="nav__link">Home</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Articles</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Photo Gallery</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Contacts</a>
</li>
</ul>
</nav>
Widget in Sidebar
<div class="widget">
<h4 class="widget__title">Growing Jelly</h4>
<div class="widget__content">
<p>To grow a communicative, friendly jelly,
we need a roll of foam rubber, two kilograms of sugar,
three eggs and half a teaspoon of acetone.</p>
<a class="widget__link" href="#">Don't Read More...</a>
</div>
</div>
News Block
<div class="news">
<h3 class="news__title">Yesterday's News</h3>
<ul class="news__list">
<!-- to element's class we are adding block's class,
to create a new namespace -->
<li class="news__item item-news">
<h4 class="item-news__title">Roach's Speed Skating Competition</h4>
<div class="item-news__text">
<p>The team of sprat from Petrozavodsk won</p>
<a href="#" class="item-news__link">Read More</a>
</div>
</li>
<li class="news__item item-news">
<h4 class="item-news__title">Scientists clarified the role of nail file in nail care</h4>
<div class="item-news__text">
<p>British scientists highly praised
the contribution of the nail file
to growing 1.5-meter long nails.</p>
<a href="#" class="item-news__link">Don't Read More</a>
</div>
</li>
</ul>
</div>
Article or Blog Post (Simple Version)
<article class="article">
<h3 class="article__title">Feeling the Chakras of a Bunch of Parsley</h3>
<time class="article__datetime">May 32, 10:87</time>
<div class="article__author author-article">
<img class="author-article__img" src="userpic.png" alt="Kloshnya Andreevna">
<a class="author-article__link" href="#">Kloshnya Andreevna Dolgorukaya</a>
<div class="author-article__desc">Our chakra expert</div>
</div>
<div class="article__content">
Go to the market and buy a bunch of parsley from old ladies for a hundred grams.
Properly sort it out and cleanse it from beetles and caterpillars. Give
the beetles to the cat to play with, settle the caterpillars in a pot with
cacti, let one be John, the other Billy, and now you will have a Wild West
in your pot. Get back to your bunch of parsley. Look at it tenderly and
scratch behind its ear, you can scratch yourself or the cat. Tie it up with
a satin ribbon, be sure to tie a bow. Congratulations! Now you have a fully
domesticated bunch of parsley that will run after you merrily and grow
their seeds in your slippers.
</div>
</article>
Article or Blog Post (Complex Version)
<article class="entry">
<header class="entry__header">
<h3 class="entry__title title-entry">
<a class="title-entry__link" href="#">Rubber Ducks as a Way of Self-Discovery</a>
</h3>
<time class="entry__datetime">May 32, 10:87</time>
</header>
<div class="entry__author author-entry">
<img class="author-entry__img" src="userpic.png" alt="Vasilisa Sergeevich">
<a class="author-entry__link" href="#">Vasilisa Sergeevich</a>
</div>
<div class="entry__content">
Get a box of fifty rubber ducks from the attic,
left over from New Year’s celebration. From the ducks
and lit candles, lay out a pentagram on the floor of
the room. Sit in the middle in lotus position, take a
German-Brazilian dictionary in each hand, cough, take
a full breath of air and say loud and confidently,
with full commitment “Quack!”
</div>
<div class="entry__tags tags-entry">
<h4 class="tags-entry__title">Tags</h4>
<ul class="tags-entry__list">
<li class="tags-entry__item">
<a class="tags-entry__link" href="#">DIY round dance</a>
</li>
<li class="tags-entry__item">
<a class="tags-entry__link" href="#">Porcelain slippers</a>
</li>
<li class="tags-entry__item">
<a class="tags-entry__link" href="#">Shoe polish in cooking</a>
</li>
</ul>
</div>
<div class="entry__actions actions-entry">
<ul class="actions-entry__list">
<li class="actions-entry__item actions-entry__item_read">
<a class="actions-entry__link" href="#">238 Replies</a>
</li>
<li class="actions-entry__item actions-entry__item_write">
<a class="actions-entry__link" href="#">Write to Sportloto</a>
</li>
<li class="actions-entry__item actions-entry__item_share">
<a class="actions-entry__link" href="#">Share</a>
</li>
</ul>
</div>
</article>