Skip to content

Instantly share code, notes, and snippets.

@kb-media
Created July 4, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kb-media/414d5bbbeb7a66602f115df87b6f2000 to your computer and use it in GitHub Desktop.
Save kb-media/414d5bbbeb7a66602f115df87b6f2000 to your computer and use it in GitHub Desktop.
Relative Werte CSS
/*RESET*/
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.beispiel1{
height: 2em;
/*für relative Breite % Angabe verwenden*/
width: 60%;
margin-left: 20%;
margin-top: 2vh; /*höhe des Viewport*/
margin-bottom: 4vh; /*höhe des Viewport*/
background-color: green;
}
.beispiel2{
height: 1em;
width: 100%;
background-color: blue;
}
.beispiel3{
height: 20em;
width: 80%;
margin-left: 10%;
background-color: red;
}
.relativeimg{
width: 50%;
/* alternativ zum Bsp. width: 50vw; vw = viewport-Breite*/
}
/*für relative Größe in Schriften vw Angabe verwenden*/
h1{
font-size:5vw;
}
p{
font-size:3vw;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment