Die responsiven Experimente gehen weiter…
Die Ausgangslage:
Wer den letzten Artikel aufmerksam gelesen hat und die Webseite auch nachgebaut hat, konnte feststellen das einige CSS Anweisungen noch nicht wirksam werden.
Das Ziel ist doch eine Webseite zu gestalten die bei einer Breite bis 600 Pixel einen roten Seitenhintergrund bekommt und einen grünen Kopfbereich. Ab 601 Pixel soll der Hintergrund die Farbe blau annehmen und der Kopfbereich gelb erstrahlen.
<link rel="stylesheet" href="01_CSS/600.css" media="screen and (max-width: 600px)">
<link rel="stylesheet" href="01_CSS/601.css" media="screen and (min-width: 601px), (max-width: 1000px)>
Der CSS Code für die Datei “600.css“:
body {
background-color: red;
color: black;
}
header {
background-color: green;
}
nav {
top: 97px;
left: 5px;
width: 210px;
background-color: steelblue;
color: white;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-left: 5px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: black;
border-right-color: black;
border-bottom-color: black;
border-left-color: black;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
font-family: Arial;
font-size: smaller;
}
nav li {
display: block;
list-style-type: none;
padding: 3px;
}
nav a:link {
color: black;
background-color: white;
display: block;
text-decoration: none;
padding: 3px;
}
nav a:visited {
color: black;
background-color: white;
display: block;
text-decoration: none;
}
nav a:hover {
background-color: red;
color: black;
display: block;
text-decoration: none;
}
nav a:focus {
color: black;
background-color: white;
display: block;
text-decoration: none;
}
nav a:active {
color: black;
background-color: white;
display: block;
text-decoration: none;
}
main {
background-color: steelblue;
color: white;
margin-top: 3px;
margin-right: 5px;
margin-bottom:5px;
margin-left: 5px; /*war 241*/
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: black;
border-right-color: black;
border-bottom-color: black;
border-left-color: black;
padding-top: 20px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
font-family: Arial;
font-size: smaller;
}
main a:link {
color: white;
background-color: steelblue;
text-decoration: underline;
}
main a:visited {
color: white;
background-color: steelblue;
text-decoration: underline;
}
main a:hover {
color: black;
background-color: white;
text-decoration: underline;
}
main a:focus {
color: white;
background-color: steelblue;
text-decoration: underline;
}
main a:active {
color: white;
background-color: steelblue;
text-decoration: underline;
}
Der CSS Code für die Datei “601.css“:
body {
background-color: blue;
color: black;
}
header {
background-color: yellow;
}