Web Programming @ MIPT, 2015-2016

Markovtsev Vadim

HTML5 (stylesheets)

Web Programming @ MIPT, 2015-2016

What is CSS

a {
	color: blue;
}
		

Rules sequence

a {
	color: blue !important;
}
a {
color: red;  /* ignored */
}
		

Selectors

Combinators

Pseudo-classes

Pseudo-elements

a::after {
  content: attr(hint);
  color: red;
}
<a hint="test"></a>

CSS box model

CSS units

Link

CSS box model options

div#container {
  margin: 1px 2em 3% 4vh;  /* top right bottom left */
  border: 1px solid blue;
  padding: auto 5vmin;  /* top = bottom, right = left */
}

Box size

box-sizing

Sets whether padding and border must be included into width and height.

CSS layout

display

Sets which element box type is used. Link.

flex-box

			display: flex;
		

position

Controlls how elements are positioned. MDN, Standard

float

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris quis ultricies nibh. Mauris posuere sit amet erat sed porttitor. Praesent interdum arcu et felis imperdiet, sodales vulputate mi auctor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque dignissim
hendrerit faucibus. Integer a viverra tortor. Aliquam varius ac dui eu convallis. Proin a ipsum lectus. Ut tristique felis justo, quis cursus dui egestas ac. Duis at porta quam, et tempus orci. Donec quis luctus est, id sagittis sapien.

Hiding elements

Centering horizontally

{
  display: table;  /* block requires setting width */
  margin-left: auto;
  margin-right: auto;
}
{
  display: inline;  /* inline-block */
  text-align: center;
}
{  /* parent */
  display: flex;
  flex-direction: row;
  justify-content: center;
}

Font

Colors

Animation

Preprocessors

There are compilers into CSS to make programmer's life easier. They add inheritance, mixins, variables, loops, etc.

Postprocessors

Manipulate CSS to improve it.

CSS frameworks

Deployment

Next steps

View on Github