CSSCSS

Styling language of the web

Need to know (before learning CSS): HTML

Connecting HTML and CSS

To insert CSS code in an HTML page we use the <style>, <link> tags or the "style" attribute. The options are to write the CSS code outside the HTML page with <link rel="stylesheet" href="/any-name-you-want.css" /> or inside the page with <style>some css</style> or on the tag with "style" attribute <p style="css code">text</p>

You can create your own css files like this "index.css" or "any-name_you_want.css", connect it to an html page and open it in your browser.

In order to set design rules with CSS to an HTML element (tag). We need to use a selector, to specify which element should the rules (declarations) apply to.

Selectors

There are some special rules selectors to be more specific about which tags should be changed. depending on the tag state or place in the page.

CSS rules are style declarations of how the selected element should appear. There are many but we will focus here on the basic ones.

Many time you will find yourself in need of change the behaviour of elements with others in the page. For those cases knowing the display and position are really useful.

To control the spacing between elements on the page we use margin and padding rules. They are similar besided the fact that margin effects the outer part of the element and padding effects the inner part of the element.

Font rules enable you to change how text appears and much more. Some of the basic useful font rules are: font-family, font-size, color, line-height, font-weight and font-style

Media queries are blocks of css with a condition to apply when it fits. Mostly used to activate rules per the screen width for mobile, tablet and desktop devices.