Learn CSS as a Beginner - day 2 | 90 Day Code
Learn CSS as a Beginner - day 2
There are three core part in web development:
- HTML
- CSS
- JavaScript
CSS - (Cascading Style Sheets) makes web page beautiful. Add makeup in text, audio, video, table, input.
CSS can style a html tag in three ways:
- Inline CSS
- Internal CSS
- External CSS
1. Inline CSS:
- It's direct apply in html element
- use style attribute
- Inline css override the style which are define by the internal or external CSS
- Ex: <p style="color: blue">I am blue text</p>
- Professionaly every developer use external css to manage their html code.
- In your html code write <link rel="stylesheet" href="style.css"/> in the head tag.
- Example:
HTML Color: you can use color in your website in five different ways.
- Color names: <h1 style="color: tomato">Tomato Color</h1>
- RGB: <h1 style="color: rgb(100, 100, 50)">RGB Color</h1>
- RGBA: <h1 style="color: rgba(100, 50, 60, 0.5)">A for Alpha: The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not transparent at all)</h1>
- HSL: hsl(hue, saturation, lightness) hue= 0 to 360, 0 is red, 120 is green, 240 is blue, saturation= 0% to 100%, 0% means shade of gray and 100% means full color. lightness= 0% is black, and 100% is white.
- HSLA: <h1 style="color: hsla(10, 5%, 55%, 0.5">HSLA Color</h1>
- HEX: In HTML, a color can be specified using a hexadecimal value. <h1 style="color: #012daa">Hexadecimal Color code</h1>
Some CSS Properties
background-color | |
height | |
width | |
font-size | |
font-weight | font-weight sets how thik or thin text. It's normal value: 400 |
font-family | it is used for how text look like. There are lot of Option to sets font-family in a text.
|
spant tag | apply style to part a paragraph |
border | border: 1px solid/deshed/dotted red; border is like a wall. |
border-radius | |
margin | top right bottom left (clock wise) margin-left: 10px; margin-top: 5px; |
padding | Use padding to away text from the border padding has 4 value: top right bottom left padding-top: 4px; padding-right: 3px; |
CSS Box Model |
|
text-align |
|
display |
|
CSS Measuring Unit: there are lot of measuring unit in CSS.
- px
- %
- em
- vw
- in
- cm
- mm
- pt
Selector in CSS: We can style our document in many ways by CSS selector.
- ID Selector:
- Grouping Selector: div, .blue { color: blue; } <p class="blue">I am blue</p> <div>I am also</div>
- Combine Selector: All p element won't blue. Only p element be blue which contains .blue class.
- Child Selector:
- Descendant Selector: Select all p element inside div element.
- div p { color: red; } <div><p>Hello</p><div>World</div></div> Here Hello text will be red.
- Adjacent Sibling Selector:
- Universal Selector: * { box-sizing: border-box;}
- Pseudo Class Selector
Comments
Post a Comment