GithubHelp home page GithubHelp logo

css-helper's Introduction

CSS

Background

background:   pink

background:   url(image)

background-repeat:   no-repeat

background-size:   cover



Border

border:   5px     solid    purple



Box Model

Every element has a box around it

  • Element - width/height:  200px        can also use % of the parent element
  • Padding - padding:  10px        sets 10px of padding all around
  • Margin - margin:  10px        sets 10px of margin all around, we can also do 0 auto which will set top and bottom to 0 and left and right to auto(center)
  • Border - border:  2px solid blue


CSS COLORS

Hex

color:  #RRGGBB

RGB

color:  rgb(0,255,0)

RGBA (A is transparency)

color:   rgb(0,255,0, .5)

CSS Colours - https://colours.neilorangepeel.com/



Float

Takes the elements out of the normal flow. For instance, we have 2 divs which are block elements, float would overwrite this.

float:   left    the div's orientation/flow would be changed to floating always to the left





Fonts and Texts

  • font-family: "Arial"
  • font-size: 200px
    • em - control the size base on the parent element. For instance, we have a p and we set one sentence in it to 2 em, the sentence will be doubled the size of p. Another example would be setting an h2 to 5 em, it will be 5 times bigger than the body since this is its parent element.
  • font-weight:  bold    (100-800)
  • line-height:  2    double-spaced
  • text-align:  center
  • text-decoration:  underline
  • text-transform:  uppercase
Available fonts in CSS -  https://www.cssfontstack.com/
Google Fonts -   https://fonts.google.com/



Selectors

  • Element/Type
  • Class     .class
  • ID     #id
  • Descendant   li a          selects every a in an li
  • Adjacent   h4 + li          selects all li that comes after h4
  • Nth of Type   ul:nth-of-type(3)          selects third ul


Specificity

An element can be targeted by multiple styles/selectors. The style that is closest/most specific to the element will be applied by CSS.
ID > Class > Element/Type

css-helper's People

Contributors

kylenrich24 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.