CSS Practice

CSS Practice

CSS Practice

Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis dolore laboriosam vero deleniti voluptate modi eaque eos? Sunt non, laborum accusantium cum saepe veniam. Distinctio omnis quo veritatis voluptas necessitatibus?

text-align controls where the text is aligned relative to the element the text is currently contained within

CSS Combinator Types [they select descendants and stuff like that]

Descendant Combinator

li a {
 color: blue;
}

Comma Combinator ( , )

li, a {
 color: blue;
}

Adjacent Combinator ( + )

li + a {
 color: blue;
}

Direct Child Combinator ( > )

li > a {
 color: blue;
}

Attribute Selector ( input[type="text"] )

li[type="text"]{
 color: blue;
}

Pseudo Classes ( : )

li:hover{
 color: blue;
}

Pseudo Elements

( :: ) Keyword added to a selector that lets you style a particular part of selected elements

Visit the MDN page to see a full list of pseudo-elements.

\

The Cascade

The order that style rules are declared matters - things that are declared afterwards (lower) in the chain will take precedence.

This counts for the HTML Link to CSS stylesheets as well. The links in the head of an html document that come lower in the chain get higher precedence.

Useful Links

The Box Model

CSS is based on boxes

Border Properties

Display Property

The Display Property

Units

percent

em's and rem's

em's are relative units that relate to font size

rem's are relative to the root html element's font-size.

Misc. Useful CSS Properties

position

static

All elements have a default value of static

relative

This will keep the element where it would normally be placed.

absolute

Removes the element from the normal flow of the document

fixed:

Like absolute, but positioned relative to the viewport/document and stays in place even when the page is scrolled, etc

Transitions

Transitions

Useful Links to Help with Transitions:

Transition Animation Easing Functions Site

The default timing function for transition animations is 'linear'

Transform

Transform Property

This is pretty much an animation technique to transform the way elements look - their position, their rotation, etc.

The origin of where the transform takes place can be changed with
transform: origin;

Various Transform Values

Transform applies to everything within a html container

Background

background-color: ~;

background-imaged: url("~");
This can also take in linear-gradients for color gradients, etc

background-size: ~; For determining how the image is sized. MDN Reference

background-position: ~; ======= Determines where the background starts

"background: "~"; is a shorthand property that can contain all of the more verbose background-properties.

In the background shorthand - the background size value may only be included immediately after <position>. Like this: center/80%
Read this for more info

Google Fonts

Flexbox

CSS Tricks - A fantastic Website for Flexbox and other CSS Technologies

MDN Docs for Flexbox

Withing a flexbox container, there are two axes (+)

Flexbox Properties

Responsive Design & Media Queries

Making a site that can respond to the size of the device one is on.

Media Queries

"Use this code when the site is X size." "Use that when in landscape mode, etc."

All media queries begin with @media () {}

Commonly used media features

The minimum width that the screen viewport can be for these effects to take place

@media (min-width: 800px) and (max-width: 800px) {
 h1 {
   color: purple;
 }
}