Websites
A Website is made of three layers.
- Content layer ⇾ Informationes ⇾ HTML
- Presentation layer ⇾ Layout ⇾ CSS
- Behavior layer ⇾ Interactions ⇾ Java Script
CSS (Cascading Style Sheets) is needed to edit the layout of websites and web applications.
Add your style sheet
Add your style sheet
write in the header underneath the title:
<link rel="stylesheet" href="folder/file.css">
Type selector
Type selector
aka element selector.
Select an element of your HTML.
Elements like div, p, li etc.
ID selector
ID selector
Targets a specific element with an id.
First give your HTML a id="meaningfulIDName"
then in your CSS #meaningfulIDName{}
ID's can only be used once and have the highest priority.
Class selector
Class selector
Targets multiple elements within a class.
First give your HTML a class="meaningfulIDName"
then in your CSS .meaningfulIDName{}
Media Queries
How to use the Media Queries
Today we access websites with all our devices. Some are as wide as a monitor. Some as narrow as smartphones. Since a wide layout wouldn't be displayed properly on a narrow one and vice versa there is the media query.
When you use the media query and give it speciffic parameters like a max browser width the browser will check first which size it has and picks the right style sheet section. There you can for example declare a diffrent font size, spacing, colors and so on.
@media (parameters like min-width: 900px)
{After that add your changes.}