CurledMark

How To Turn Your CSS From Zero To Hero

CSS is the language we use to style an HTML document. It describes how HTML elements should be displayed. It stands for Cascading Style Sheets. HTML provides the structure of the page, CSS the (visual and aural) layout, for a variety of devices.

It can control the layout of multiple web pages all at once. External stylesheets are stored in Cascading Style Sheet files.

HTML: What to display
CSS: How to display

3 ways of adding CSS in HTML:

1. Internal

<style>
p
{
color: blue;
}
</style>

2. Inline

has the highest priority

<p style=”color: blue width: 18px>

3.External

<link rel=”stylesheet” type=”text/css” href=”style.css”> it is name of the file

3 basic types of selectors

1. Element Selector

p
{
color: red;
}

2. id Selector

index.html(html file name)

<p id=”para”>paragraph</p>

style.css(file name)

#para
{
color: yellow;
}

3. class Selector

index.html(html file name)

<h1 class=”greencl”>heading</h1>

<p class=”greencl”>paragraph</p>

style.css(file name)

.greencl
{
color: green;
}

4. Priority order

id then class then element selector

5. /* comment */ 

comment in cascading style sheet

Colors can be specified using

* predefined color names

* RGB

* RGBA

* HEX

* HSL

* HSLA

ColorCodes, With this link you can find all the codes of colors.

rgb (red, green, blue) ranges from 0 to 255

Black: rgb(0,0,0)
White: rgb(255,255,255)
Red: rgb(255,0,0)
Green: rgb(0,255,0)
Blue : rgb(0,0,255)

rgba (red, green, blue, alpha) – 0.0 (fully transparent) and 1.0 ( not transparent at all)

rgba(255,99,71,0.5)

HEX ranges from 0 to f

#rrggbb
Red: #ff0000
Black : #000000
White: #ffffff

HSL(hue, saturation, lightness)

Red: hsl(0, 100%, 50%)

HSLA(hue, saturation, lightness, alpha)

Backgrounds

Mentioned only one example

body {

background-color: blue;

}

Border

  1. border-style: solid/dotted/dashed/double/groove/outset/inset/ridge/none;
  2. border-width: 5px;
  3. border-color: red;
  4. border-top-style: solid;
  5. border-top-width: 10px;
  6. border-top-color: green;
  7. border-radius: 50px; (for curving the border)
  8. height: 500px;
  9. width: 70%;
  10. max-width: 500px;
  11. max-height: 300px;
  12. min-width: 500px;
  13. min-height: 300px;

Padding

The gap between border and content is padding.

 

To be Continued…….

 

Also, read

Think and Grow Rich

The Forty Rules of Love Summary

Make Time

So good they can’t ignore you

You are a Badass At Making Money

The Norwegian Wood by Murakami Summary

Man’s Search For Meaning

The Great Gatsby

Relentless Summary

The Da Vinci Code by Dan Brown Summary