I'm trying to create a div (text) on top of another div (rotated white plane). When I create a new div the text is being placed behind and on a lower layer as the previous plane. This is the current website (I'm trying to get text under the bottle image):
Click here
My code (CSS & HTML):
/* Navigation Bar */
.topnav a {
float: left;
color: lightgray;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
vertical-align: center;
}
.topnav a.logo {
float: left;
text-align: center;
padding: 0px 0px;
text-decoration: none;
font-size: 17px;
}
.topnav a.index:hover {
background-color: #ddd;
color: black;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #FC8E11;
font-weight: bold;
color: white;
}
.topnav {
background-color: #333;
overflow: hidden;
font-family: arial;
}
/* Body settings */
body {
margin: 0px;
padding: 0px;
background-color: #FFFF;
height: 2000px;
overflow-x: hidden;
}
.content {
position: relative;
}
.plane {
background-color: white;
width: 120%;
-ms-transform: rotate(5deg);
transform: rotate(5deg);
height: 370px;
position: absolute;
bottom: -140px;
left: -10%;
}
.plane2 {
background-color: #FC8E11;
position: absolute;
width: 100%;
height: 870px;
left: 0;
top: 0px;
z-index: -5;
}
.titletext {
text-align: middle;
}
.product_image {
margin-left: auto;
margin-right: auto;
width: 800px;
padding-top: 40px;
}
.container {
margin: 0;
padding: 0;
width: 50%;
margin-left: auto;
margin-right: auto;
padding-top: 220px;
}
.tekst {
width: 100%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 16px;
}
<!--Navigation Bar-->
<div class="topnav">
<a class="logo" href="index.html"><img src="/images/logo_groot.png" alt="logo" width="48" height="48" align="left"></a>
<a class="index active" href="index.html">Over ons</a>
<a class="index" href="verkooplocaties.html">Verkooplocaties</a>
<a class="index" href="contact.html">Contact</a>
</div>
<div class="content">
<!--Illustration-->
<div class="product_image">
<img src="/images/illustration.png" width="800px" height="800px">
</div>
<!--Planes-->
<div class="plane2"></div>
<div class="plane"></div>
</div>
<div class="container">
<!--Text-->
<div class="tekst">
<p> Heb je tijdens het sporten sleutels of pin- & sportpassen bij je? Hinderen deze spullen je soms bij het sporten? BottleBuidel is een houder voor je drinkfles waar je deze spullen in kan bewaren tijdens het sporten. Door de flexibele stof past de BottleBuidel
om iedere sportfles en kun je daardoor altijd je spullen bij je houden zonder dat je deze hoeft te bewaren in je broekzakken of op de grond. De BottleBuidel is gemaakt van geupcyclede (gewassen!) sportbroeken waardoor het bijdraagt aan een duurzamere
wereld! Meer informatie over het product, verkooplocaties en de prijs is te vinden op de product pagina.</p>
</div>
</div>
you can try giving z-index to the div maybe z-index is the order of something in the z dimension lets say if you want the second div to be in front you can give it the z-index of one
the code looks like this:
z-index:1;
Related
My footer is displaying on top of my main. I've been looking for days to fix this now but can't seem to find a solution. My teacher couldn't find it aswell. I hope someone of you can see where the problem is and would appreciate it so much to take time to look at it! It's driving me crazy...
Thank you so much on advance!
here is the link
html {
box-sizing: border-box;
font-size: 62.5%;
font-family: 'Fira Sans';
scroll-behavior: smooth;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
#font-face {
font-family: 'Fira Sans';
src: url(../assets/fonts/FiraSans-Regular.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Light';
src: url(../assets/fonts/FiraSans-Light.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Heavy';
src: url(../assets/fonts/FiraSans-Heavy.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Extra Bold';
src: url(../assets/fonts/FiraSans-ExtraBold.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Hair Italic';
src: url(../assets/fonts/FiraSans-HairItalic.otf) format('opentype');
}
#font-face {
font-family: 'Moon';
src: url(../assets/fonts/Moon-Light.otf) format('opentype');
}
.bg-header {
background-image: url(../assets/img/paintdrop-test-01-01.svg);
height: 77.5rem;
width: 128.6rem;
;
background-repeat: no-repeat;
background-position: top;
margin: 0 auto;
}
.container-header {
width: 96rem;
margin: 0 auto;
display: flex;
flex-direction: column;
}
nav {
display: flex;
justify-content: center;
padding: 4rem 0rem;
}
nav ul {
display: flex;
justify-content: space-between;
width: 50%;
}
nav ul li {
list-style: none;
display: inline;
}
a {
text-decoration: none;
color: black;
text-transform: uppercase;
font-family: 'Fira Sans';
letter-spacing: .2rem;
font-size: 1.5rem;
display: block;
padding: 1rem 2rem;
}
.link:hover
/*, a:not([class="button-wit"])*/
{
color: white;
border-radius: 1.5rem;
background: linear-gradient(to left, #363795, #005c97);
transition: all .2s ease-in-out;
}
.title {
display: flex;
background-image: url(../assets/img/blue-monday-title.svg);
background-repeat: no-repeat;
background-position: center center;
width: 100%;
height: 50rem;
}
h1 {
font-size: 13.5rem;
text-transform: uppercase;
font-family: 'Fira Sans Heavy';
}
.hide {
display: none;
}
.intro {
font-size: 2rem;
letter-spacing: .15rem;
line-height: 1.5;
width: 45%;
margin-left: 37rem;
margin-top: -22rem;
font-family: 'Fira Sans Light';
}
.btn-class {
display: flex;
justify-content: center;
transition: all 1s ease-in-out;
}
.button-blue {
margin: 10rem 0rem 5rem 10rem;
color: white;
border-radius: 1.5rem;
background: linear-gradient(to left, #363795, #005c97);
}
.button-blue:hover {
transform: scale(1.1);
}
main {
margin-top: 7rem;
}
h2 {
font-family: 'Fira Sans Extra Bold';
letter-spacing: .18rem;
font-size: 6.5rem;
}
/* .bg-main-small{
background-image: url(../assets/img/splash-drop-small-01.svg);
height: 40rem;
width: 40rem;
background-position: left;
background-repeat: no-repeat;
position: absolute;
margin-left: 5rem;
} */
.bg-main-big {
background-image: url(../assets/img/splash-drop-02-01.svg);
height: 70rem;
width: 100%;
background-position: right;
background-repeat: no-repeat;
}
.container-main {
width: 96rem;
margin: 0 auto;
display: flex;
flex-direction: column;
}
.article-1 {
display: flex;
flex-direction: column;
margin-top: 30rem;
margin-left: 5rem;
}
.article-text {
margin-top: 2rem;
font-family: "Fira Sans Light";
font-size: 2rem;
letter-spacing: .1rem;
line-height: 3.2rem;
width: 50%;
}
.bg-flow {
margin-top: 5rem;
background-image: url(../assets/img/flow_1.svg);
height: 120rem;
width: 100%;
background-position: center;
background-repeat: no-repeat;
}
.article-2 {
color: white;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 45rem;
}
.mid {
text-align: center;
width: 70%;
}
.button-wit {
color: white;
border-radius: 1.5rem;
margin-top: 5rem;
border: .1rem solid white;
}
.button-wit:hover {
background-color: white;
color: #005c97;
}
.article-3 {
display: flex;
margin-top: 45rem;
}
.blue-moonday-text {
display: flex;
flex-direction: column;
padding-left: 5rem;
}
.right {
width: 100%;
}
.footer-img {
background-image: url(../assets/img/footer-splashes-01.svg);
background-repeat: no-repeat;
height: 30rem;
width: 100%;
}
.container-footer {
width: 96rem;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: space-between;
text-align: right;
padding-top: 25rem;
}
footer li {
height: 8rem;
list-style: none;
text-decoration: none;
}
.social-media {
padding-top: 5rem;
display: flex;
justify-content: space-between;
}
<header>
<div class="bg-header">
<div class="container-header">
<h1 class="hide">Blue Monday</h1>
<nav>
<ul>
<li>home</li>
<li>activiteiten</li>
<li>extra </li>
</ul>
</nav>
<div class="title"></div>
<p class="intro">Het is ondertussen geen geheim meer. Maandagen zijn echt kutdagen. Maar als je er dan eentje moet uitkiezen die de ergste is, dan is het wel deze. </p>
</div>
<div class="btn-class">
Discover more
</div>
</div>
</header>
<main>
<!-- <div class="bg-main-small"></div> -->
<div class="bg-main-big" id="blok1">
<div class="container-main">
<article class="article-1">
<h2>Feeling blue.</h2>
<p class="article-text">Het is amper 2 weken na het nieuwe jaar. Het jaar dat JOUW jaar ging worden... <br> Alleen zijn al je goede voornemens al mislukt, de vakantie lijkt nog mijlenver en bovendien maakt dit weer het geen haar beter. “To feel blue” betekent letterlijk
je rot of triestig voelen en dat is dan ook het gevoel dat je met nog veel andere mensen deelt.</p>
</article>
</div>
</div>
<div class="bg-flow">
<div class="container-main">
<article class="article-2">
<h2>Je bent niet alleen.</h2>
<p class="article-text mid">Je staat er niet alleen voor. Iedereen heeft last van deze dag. Elk jaar opnieuw is blue monday de meest depressieve dag ter wereld. Maar wij zullen proberen om blue monday wat meer kleur te geven!</p>
<br>
<span> activiteiten </span>
</article>
<article class="article-3">
<img src="./assets/img/moon-with-holes.svg" alt="Blue Moonday" width="500" height="500" class="blue-moon">
<div class="blue-moonday-text">
<h2>Blue Moonday.</h2>
<p class="article-text right">Voor degene die niet genoeg hebben aan deze tips: er is meer. Denk je dat de sky the limit is? Het kan verder. Veel verder. Zo ver dat je even een tripje naar de maan kan maken op deze dag waardoor je simpelweg blue monday kan overslaan! Laat
deze mensen maar afzien op deze kutdag op aarde, jij bent even gaan viben in space.</p>
</div>
</article>
</div>
</div>
</main>
<footer>
<!-- <div class="footer-img"></div> -->
<div class="container-footer">
<ul>
<li>Home</li>
<li>About</li>
<li>Devine</li>
</ul>
<div class="social-media">
<img src="./assets/img/devine.png" alt="devine" width=50 height=50>
<img src="./assets/img/facebook.png" alt="facebook" width=50 height=50>
<img src="./assets/img/twitter.png" alt="twitter" width=50 height=50>
</div>
</div>
</footer>
to the website
Your .bg-flow div has a fixed height.
Just get rid off it.
Also, I would advice you to remove the flex parameters from your .container-footer, since it is not part of the flow of elements displayed. Flex items need to be consecutive. You've defined the elements in container main as flex, but this is in your footer.
Last point, I don't know if you want these footer links to have this vertical appearance, if not, I think you should define this:
footer ul li {
display: inline-block; // or float: left; as you prefer.
}
Let me know if it works for you.
This is because your .bg-flow has a height value 102rem and your content is exceddind the height value.
I will suggest use min-height instead of height, if you want to give height to that div
Stack Snippet
html {
box-sizing: border-box;
font-size: 62.5%;
font-family: 'Fira Sans';
scroll-behavior: smooth;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
#font-face {
font-family: 'Fira Sans';
src: url(../assets/fonts/FiraSans-Regular.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Light';
src: url(../assets/fonts/FiraSans-Light.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Heavy';
src: url(../assets/fonts/FiraSans-Heavy.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Extra Bold';
src: url(../assets/fonts/FiraSans-ExtraBold.otf) format('opentype');
}
#font-face {
font-family: 'Fira Sans Hair Italic';
src: url(../assets/fonts/FiraSans-HairItalic.otf) format('opentype');
}
#font-face {
font-family: 'Moon';
src: url(../assets/fonts/Moon-Light.otf) format('opentype');
}
.bg-header {
background-image: url(../assets/img/paintdrop-test-01-01.svg);
height: 77.5rem;
width: 128.6rem;
;
background-repeat: no-repeat;
background-position: top;
margin: 0 auto;
}
.container-header {
width: 96rem;
margin: 0 auto;
display: flex;
flex-direction: column;
}
nav {
display: flex;
justify-content: center;
padding: 4rem 0rem;
}
nav ul {
display: flex;
justify-content: space-between;
width: 50%;
}
nav ul li {
list-style: none;
display: inline;
}
a {
text-decoration: none;
color: black;
text-transform: uppercase;
font-family: 'Fira Sans';
letter-spacing: .2rem;
font-size: 1.5rem;
display: block;
padding: 1rem 2rem;
}
.link:hover
/*, a:not([class="button-wit"])*/
{
color: white;
border-radius: 1.5rem;
background: linear-gradient(to left, #363795, #005c97);
transition: all .2s ease-in-out;
}
.title {
display: flex;
background-image: url(../assets/img/blue-monday-title.svg);
background-repeat: no-repeat;
background-position: center center;
width: 100%;
height: 50rem;
}
h1 {
font-size: 13.5rem;
text-transform: uppercase;
font-family: 'Fira Sans Heavy';
}
.hide {
display: none;
}
.intro {
font-size: 2rem;
letter-spacing: .15rem;
line-height: 1.5;
width: 45%;
margin-left: 37rem;
margin-top: -22rem;
font-family: 'Fira Sans Light';
}
.btn-class {
display: flex;
justify-content: center;
transition: all 1s ease-in-out;
}
.button-blue {
margin: 10rem 0rem 5rem 10rem;
color: white;
border-radius: 1.5rem;
background: linear-gradient(to left, #363795, #005c97);
}
.button-blue:hover {
transform: scale(1.1);
}
main {
margin-top: 7rem;
}
h2 {
font-family: 'Fira Sans Extra Bold';
letter-spacing: .18rem;
font-size: 6.5rem;
}
/* .bg-main-small{
background-image: url(../assets/img/splash-drop-small-01.svg);
height: 40rem;
width: 40rem;
background-position: left;
background-repeat: no-repeat;
position: absolute;
margin-left: 5rem;
} */
.bg-main-big {
background-image: url(../assets/img/splash-drop-02-01.svg);
height: 70rem;
width: 100%;
background-position: right;
background-repeat: no-repeat;
}
.container-main {
width: 96rem;
margin: 0 auto;
display: flex;
flex-direction: column;
}
.article-1 {
display: flex;
flex-direction: column;
margin-top: 30rem;
margin-left: 5rem;
}
.article-text {
margin-top: 2rem;
font-family: "Fira Sans Light";
font-size: 2rem;
letter-spacing: .1rem;
line-height: 3.2rem;
width: 50%;
}
.bg-flow {
margin-top: 5rem;
background-image: url(../assets/img/flow_1.svg);
min-height: 120rem;
width: 100%;
background-position: center;
background-repeat: no-repeat;
}
.article-2 {
color: white;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 45rem;
}
.mid {
text-align: center;
width: 70%;
}
.button-wit {
color: white;
border-radius: 1.5rem;
margin-top: 5rem;
border: .1rem solid white;
}
.button-wit:hover {
background-color: white;
color: #005c97;
}
.article-3 {
display: flex;
margin-top: 45rem;
}
.blue-moonday-text {
display: flex;
flex-direction: column;
padding-left: 5rem;
}
.right {
width: 100%;
}
.footer-img {
background-image: url(../assets/img/footer-splashes-01.svg);
background-repeat: no-repeat;
height: 30rem;
width: 100%;
}
.container-footer {
width: 96rem;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: space-between;
text-align: right;
padding-top: 25rem;
}
footer li {
height: 8rem;
list-style: none;
text-decoration: none;
}
.social-media {
padding-top: 5rem;
display: flex;
justify-content: space-between;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blue Monday</title>
<link rel="icon" href="./assets/img/devine.png">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
<!-- <link href="https://fonts.googleapis.com/css?family=Fira+Sans" rel="stylesheet"> -->
</head>
<body>
<header>
<div class="bg-header">
<div class="container-header">
<h1 class="hide">Blue Monday</h1>
<nav>
<ul>
<li>home</li>
<li>activiteiten</li>
<li>extra </li>
</ul>
</nav>
<div class="title"></div>
<p class="intro">Het is ondertussen geen geheim meer. Maandagen zijn echt kutdagen. Maar als je er dan eentje moet uitkiezen die de ergste is, dan is het wel deze. </p>
</div>
<div class="btn-class">
Discover more
</div>
</div>
</header>
<main>
<!-- <div class="bg-main-small"></div> -->
<div class="bg-main-big" id="blok1">
<div class="container-main">
<article class="article-1">
<h2>Feeling blue.</h2>
<p class="article-text">Het is amper 2 weken na het nieuwe jaar. Het jaar dat JOUW jaar ging worden... <br> Alleen zijn al je goede voornemens al mislukt, de vakantie lijkt nog mijlenver en bovendien maakt dit weer het geen haar beter. “To feel blue” betekent letterlijk
je rot of triestig voelen en dat is dan ook het gevoel dat je met nog veel andere mensen deelt.</p>
</article>
</div>
</div>
<div class="bg-flow">
<div class="container-main">
<article class="article-2">
<h2>Je bent niet alleen.</h2>
<p class="article-text mid">Je staat er niet alleen voor. Iedereen heeft last van deze dag. Elk jaar opnieuw is blue monday de meest depressieve dag ter wereld. Maar wij zullen proberen om blue monday wat meer kleur te geven!</p>
<br>
<span> activiteiten </span>
</article>
<article class="article-3">
<img src="./assets/img/moon-with-holes.svg" alt="Blue Moonday" width="500" height="500" class="blue-moon">
<div class="blue-moonday-text">
<h2>Blue Moonday.</h2>
<p class="article-text right">Voor degene die niet genoeg hebben aan deze tips: er is meer. Denk je dat de sky the limit is? Het kan verder. Veel verder. Zo ver dat je even een tripje naar de maan kan maken op deze dag waardoor je simpelweg blue monday kan overslaan! Laat
deze mensen maar afzien op deze kutdag op aarde, jij bent even gaan viben in space.</p>
</div>
</article>
</div>
</div>
</main>
<footer>
<!-- <div class="footer-img"></div> -->
<div class="container-footer">
<ul>
<li>Home</li>
<li>About</li>
<li>Devine</li>
</ul>
<div class="social-media">
<img src="./assets/img/devine.png" alt="devine" width=50 height=50>
<img src="./assets/img/facebook.png" alt="facebook" width=50 height=50>
<img src="./assets/img/twitter.png" alt="twitter" width=50 height=50>
</div>
</div>
</footer>
</body>
</html>
I've been working on a website as a first year project, this is our first website that we need to make but i found out that we were supposed to use the <!DOCTYPE html> instead of <html> (which was told later on) but now that i do that, the background of my container/content div disappears and only shows a bit when i put a letter inside of it.
* {
padding: 0;
margin: 0;
min-height: 1px;
min-width: 1px;
}
html {
height: 100%;
}
#nav {
width: 100%;
background: linear-gradient(#009940, #009900, #009800);
}
#nav ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
#nav li {
float: left;
}
#nav li a {
display: block;
transition: background-color 0.5s ease;
color: white;
font-size: 16px;
padding: 14px 18px;
text-align: center;
text-decoration: none;
}
#nav li a:hover {
background-color: #396108;
}
#nav li a img {
position: absolute;
margin-top: -0.4%;
margin-left: -0.7%;
}
#container {
width: 70%;
margin-left: 15%;
vertical-align: top;
}
#container #header {
width: 100%;
height: 3%;
background: linear-gradient(#009940, #008000, #009800);
}
#container #header p {
color: white;
font-size: 1.4em;
padding-top: 0.5%;
}
#content {
width: 100%;
height: 100%;
background-color: #e6e6e6;
}
.textClass {
border: 2px solid black;
margin-top: 7.5%;
margin-left: 5%;
margin-right: 5%;
width: 40%;
height: 20.7%;
background-color: white;
overflow: hidden;
float: left;
}
.textClass img {
padding-left: 1%;
padding-top: 1%;
padding-right: 1%;
width: 25%;
float: left;
transition:height 0s 10000s;
}
.textClass p {
padding-top: 0.5%;
word-wrap: break-word;
vertical-align: top;
}
.gallery {
float: left;
margin-top: 9%;
margin-left: 9%;
}
.gallery:hover img {
transform: scale(1);
transition: transform 1.5s ease;
}
.gallery img:hover {
transform: scale(1.75);
}
footer {
background-color: #009902;
text-align: center;
margin-left: 0;
color: white;
width: 70%;
margin-left: 15%;
margin-top: 70%;
}
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>Interreses - Website</title>
<link rel="shortcut icon" type="image/x-icon" href="/images/Logo.ico" />
</head>
<body>
<div id="nav">
<ul>
<li>Home</li>
<li>Interreses</li>
<li>Groepsleden</li>
<li>Opleiding</li>
<li>Fotogalerij</li>
<li style="float: right;"><a style="width: 20px; height: 20px;" href="/index.html"><img src="/images/logo.png"></img></a></li>
</ul>
</div>
<div id="container">
<div id="header">
<p style="text-align: center;"> Interesses </p>
</div>
<div id="content">
<div style="width: 60%; height: 70%; margin-left: 19%; margin-top: 12%;" class="textClass">
<p style="font-size: 1.2em; text-align: center;">Ik ben geinterreseerd in Gamen, Programmeren en Video Editing, ik zal ook uitleggen waarom.<br>
<br>
</p>
<img src="/images/Gamen.jpg"/>
<p style="font-size: 1.2em;">Gamen is leuk om te doen in mijn vrije tijd, ik hoop dan ook wel minimaal 60 uur per twee weken aan gamen besteed, bijvoorbeeld: <br>
Gta V: 50 Uren <br>
Cs:Go: 193 Uren <br>
Age of empires 2: 71 Uren <br>
Skyrim: 41 Uren <br>
Garry's mod: 16 Uren<br>
</p>
<img src="/images/Programmeren.jpg"/>
<p style="font-size: 1.2em;">Programmeren is ook een hobby van mij, ik programmeer meestal in Java maar nu ook in Javascipt, HTML5 en CSS3, dit kon ik overigens wel al, maar ik heb het lang niet meer <br>
Java: 3 jaar <br>
HTML: 1/2-1 jaar <br>
CSS3: 1/2-1 jaar <br>
Javascript: 1-4 maanden<br>
</p>
<img src="/images/Java.png"/>
<p style="font-size: 1.2em;"><br>
Java is mijn favoriete taal waar ik later ook een baan mee wil krijgen <br>
ik programmeer al 3 jaar java, bijvoorbeeld: <br>
Enumeratie, Abstracte classes <br>
Interfaces en objecten <br>
en nog veel meer, meestal programmeer ik plugins voor games bijvoorbeeld Maple Story, Rune Scape en Minecraft </p>
<img style="margin-left: -27%; margin-top: 7%;" src="/images/VidEdit.jpg"/>
<p style="font-size: 1.2em; margin-top: 7%;"><br>
Video Editing deed ik erg vaak, nu niet meer maar het was wel een leuke tijdbesteding van mij <br>
MLG compilatie filmpjes maken en ze daarna weer verwijderen <br>
ik deed het video editing puur om het editen dus ik heb dus overige data want mijn PC is gereset<br>
</p>
</div>
</div>
</div>
</body>
<footer id="footer" style="margin-left: 0; color: white; width: 70%; margin-left: 15%;">Copyright by ******** (C) 2016-2019</footer>
</html>
The background of the content/container should be light gray
As already stated in the other answers you still need the <html> tag. Footer you said was by accident outside the body but I placed it inside the body in the snippet below. One way to get your elements flowing correctly in your HTML structure is to set float: left; to your #content div.
* {
padding: 0;
margin: 0;
min-height: 1px;
min-width: 1px;
}
#nav {
width: 100%;
background: linear-gradient(#009940, #009900, #009800);
}
#nav ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
#nav li {
float: left;
}
#nav li a {
display: block;
transition: background-color 0.5s ease;
color: white;
font-size: 16px;
padding: 14px 18px;
text-align: center;
text-decoration: none;
}
#nav li a:hover {
background-color: #396108;
}
#nav li a img {
position: absolute;
margin-top: -0.4%;
margin-left: -0.7%;
}
#container {
width: 70%;
margin-left: 15%;
vertical-align: top;
}
#container #header {
width: 100%;
height: 3%;
background: linear-gradient(#009940, #008000, #009800);
}
#container #header p {
color: white;
font-size: 1.4em;
padding-top: 0.5%;
}
#content {
width: 100%;
height: 100%;
float: left;
background-color: #e6e6e6;
}
.textClass {
border: 2px solid black;
margin-top: 7.5%;
margin-left: 5%;
margin-right: 5%;
width: 40%;
height: 20.7%;
background-color: white;
overflow: hidden;
float: left;
}
.textClass img {
padding-left: 1%;
padding-top: 1%;
padding-right: 1%;
width: 25%;
float: left;
transition: height 0s 10000s;
}
.textClass p {
padding-top: 0.5%;
word-wrap: break-word;
vertical-align: top;
}
.gallery {
float: left;
margin-top: 9%;
margin-left: 9%;
}
.gallery:hover img {
transform: scale(1);
transition: transform 1.5s ease;
}
.gallery img:hover {
transform: scale(1.75);
}
footer {
background-color: #009902;
text-align: center;
margin-left: 0;
color: white;
width: 70%;
margin-left: 15%;
margin-top: 70%;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Interreses - Website</title>
<link rel="shortcut icon" type="image/x-icon" href="/images/Logo.ico" />
</head>
<body>
<div id="nav">
<ul>
<li>Home
</li>
<li>Interreses
</li>
<li>Groepsleden
</li>
<li>Opleiding
</li>
<li>Fotogalerij
</li>
<li style="float: right;">
<a style="width: 20px; height: 20px;" href="/index.html">
<img src="/images/logo.png" />
</a>
</li>
</ul>
</div>
<div id="container">
<div id="header">
<p style="text-align: center;">Interesses</p>
</div>
<div id="content">
<div style="width: 60%; height: 70%; margin-left: 19%; margin-top: 12%;" class="textClass">
<p style="font-size: 1.2em; text-align: center;">Ik ben geinterreseerd in Gamen, Programmeren en Video Editing, ik zal ook uitleggen waarom.
<br>
<br>
</p>
<img src="/images/Gamen.jpg" />
<p style="font-size: 1.2em;">Gamen is leuk om te doen in mijn vrije tijd, ik hoop dan ook wel minimaal 60 uur per twee weken aan gamen besteed, bijvoorbeeld:
<br>Gta V: 50 Uren
<br>Cs:Go: 193 Uren
<br>Age of empires 2: 71 Uren
<br>Skyrim: 41 Uren
<br>Garry's mod: 16 Uren
<br>
</p>
<img src="/images/Programmeren.jpg" />
<p style="font-size: 1.2em;">Programmeren is ook een hobby van mij, ik programmeer meestal in Java maar nu ook in Javascipt, HTML5 en CSS3, dit kon ik overigens wel al, maar ik heb het lang niet meer
<br>Java: 3 jaar
<br>HTML: 1/2-1 jaar
<br>CSS3: 1/2-1 jaar
<br>Javascript: 1-4 maanden
<br>
</p>
<img src="/images/Java.png" />
<p style="font-size: 1.2em;">
<br>Java is mijn favoriete taal waar ik later ook een baan mee wil krijgen
<br>ik programmeer al 3 jaar java, bijvoorbeeld:
<br>Enumeratie, Abstracte classes
<br>Interfaces en objecten
<br>en nog veel meer, meestal programmeer ik plugins voor games bijvoorbeeld Maple Story, Rune Scape en Minecraft</p>
<img style="margin-left: -27%; margin-top: 7%;" src="/images/VidEdit.jpg" />
<p style="font-size: 1.2em; margin-top: 7%;">
<br>Video Editing deed ik erg vaak, nu niet meer maar het was wel een leuke tijdbesteding van mij
<br>MLG compilatie filmpjes maken en ze daarna weer verwijderen
<br>ik deed het video editing puur om het editen dus ik heb dus overige data want mijn PC is gereset
<br>
</p>
</div>
</div>
</div>
<footer id="footer" style="margin-left: 0; color: white; width: 70%; margin-left: 15%;">Copyright by ******** (C) 2016-2019</footer>
</body>
</html>
Niet beat me to it in the comments on your post but #content isn't defined anywhere in your html. I'm assuming that the div with the textClass class is what you want the content to be so just add it to that div as you've done above.
Some other minor points:
You still need the opening <html> tag under your !DOCTYPE definition
<footer> should be inside <body> with everything else
I'd recommend setting those repeated <p> styles in your main content to a containing div such as the offending #content id. The styles will still be pulled through as they are now.
ID content is missing, but i've made some simple changes in css. Is this what you are looking for?
* {
padding: 0;
margin: 0;
min-height: 1px;
min-width: 1px;
}
html {
height: 100%;
}
#nav {
width: 100%;
background: linear-gradient(#009940, #009900, #009800);
}
#nav ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
#nav li {
float: left;
}
#nav li a {
display: block;
transition: background-color 0.5s ease;
color: white;
font-size: 16px;
padding: 14px 18px;
text-align: center;
text-decoration: none;
}
#nav li a:hover {
background-color: #396108;
}
#nav li a img {
position: absolute;
margin-top: -0.4%;
margin-left: -0.7%;
}
#container {
width: 100%;
vertical-align: top;
background-color: #e6e6e6;
}
#container #header {
width: 70%;
height: 3%;
margin: 0 auto;
background: linear-gradient(#009940, #008000, #009800);
}
#container #header p {
color: white;
font-size: 1.4em;
padding-top: 0.5%;
}
.textClass {
border: 2px solid black;
margin-top: 7.5%;
margin-left: 5%;
margin-right: 5%;
width: 40%;
height: 20.7%;
background-color: white;
overflow: hidden;
float: left;
}
.textClass img {
padding-left: 1%;
padding-top: 1%;
padding-right: 1%;
width: 25%;
float: left;
transition:height 0s 10000s;
}
.textClass p {
padding-top: 0.5%;
word-wrap: break-word;
vertical-align: top;
}
.gallery {
float: left;
margin-top: 9%;
margin-left: 9%;
}
.gallery:hover img {
transform: scale(1);
transition: transform 1.5s ease;
}
.gallery img:hover {
transform: scale(1.75);
}
footer {
background-color: #009902;
text-align: center;
margin-left: 0;
color: white;
width: 70%;
margin-left: 15%;
margin-top: 70%;
}
The !doctype html tells your html page which version of HTML are you using.By default , it is the latest version that is HTML 5.
Now, html /html these tags define the starting and ending of your html page.
These are mandatory tags for your HTML page.
And in addition to these tags you use !doctype html tag.
Hope this helps you .
Add the following line after your <body>
<div id="content">
and then make sure to close the div before </body>
As Niet pointed out, you were lacking an element with the id of 'content'
<!doctype html>
does not replace the <html> tag. You need both, see http://www.w3ctutorial.com/tags/tag_doctype.
<!DOCTYPE html>
<html>
<head>...</head>
...
</html>
Does that help?
I have a 3 <a>'s to get the text you want, but it moves with the text that you want to get, it goes up and down with the text:
It keeps resizing with them and i've been trying to change this for a hour.
This is my css:
* {
padding: 0;
margin: 0;
}
#nav {
//background-color: #666;
position: fixed;
width: 100%;
background: linear-gradient(#009940, #009900, #009800);
}
#nav ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
#nav li {
float: left;
}
#nav li a {
display: block;
transition: background-color 0.5s ease;
color: white;
font-size: 16px;
padding: 14px 18px;
text-align: center;
text-decoration: none;
}
#container {
width: 70%;
margin-left: 15%;
vertical-align: top;
height: 140%;
background-color: #e6e6e6;
}
#nav li a:hover {
background-color: #396108;
}
#nav li a img {
position: absolute;
margin-top: -0.4%;
margin-left: -1%;
}
#Text-marge {
margin-left: 30%;
margin-top: 0.2%;
width: 45%;
height: 29.5%;
padding-left: 4px;
background-color: gray;
overflow: hidden;
float: left;
}
#text-marge > p {
margin-left: 5%;
margin-top: 8%;
vertical-align: top;
}
#clicker > p {
display: inline-block;
//position: absolute;
float: left;
vertical-align: top;
}
#clicker {
margin-left: 28%;
margin-top: 12%;
}
#clicker ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
#clicker li {
float: left;
}
#clicker li a {
display: block;
font-size: 24px;
padding: 14px 18px;
text-decoration: none;
color: white;
float: left;
}
#text {
}
and this my HTML:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>Homepage</title>
<script>
function runButton1() {
document.getElementById("text").innerHTML = "";
}
function runButton2() {
document.getElementById("text").innerHTML = "b";
}
function runButton3() {
document.getElementById("text").innerHTML = "c";
}
</script>
</head>
<body>
<div id="nav">
<ul>
<li>Home</li>
<li>Interreses</li>
<li>Groepsleden</li>
<li>Opleiding</li>
<li>Fotogalerij</li>
<li style="float: right;"><a style="width: 20px; height: 20px;" href="/index.html"><img src="logo.png"></img></a></li>
</ul>
</div>
<div id="container">
<img style="margin-top: 10%; margin-left: 5%; width: 25%;" align="middle" src="geslaagd.png"/>
<h1 style="margin-left: 12%; margin-top: -32%;">Geslaagd!</h1>
<div id="Text-marge">
<p id="text">In 2016 ben ik geslaagd en kon ik mijn droom opleiding volgen <br> en die opleiding heet: "Applicatie Ontwikkelaar" <br> ik hou van programmeren en dus vond ik dat het bij mij past <br> daarom had ik zo hard mogelijk gewerkt om het te halen. <br> Nu zit ik in een leuk project team waar je ook over kan lezen op <br> deze site, Kyran, Luuk, Collin, Dewi, Jeremy en Xander <br> zijn mijn teamleden. <br> Ik ben 17 jaar oud</p>
<div id="clicker">
<ul>
<li><a onclick="runButton1()">*</a></li>
<li><a onclick="runButton2()">*</a></li>
<li><a onclick="runButton3()">*</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
CBroe is correct Lucas. Set the div #clicker to position: absolute;. Make sure it's parent #text-marge is set to position: relative;.
You can position elements that are declared as absolute by using top/bottom etc. find out more here.
Also read this as to why its parent should be relatively positioned.
I want to class="contactvlak" to get next to class="middentextvak", I've tried a lot of things like changing positions etc. but it doesn't seem to work at all. I'm sorry if this sounds like a really stupid question.
<div class="midden">
<img class="logo" src="images/logo.png">
<div class="middentextvak">
<h1>Welkom bij autorijschool NRV! </h1>
<p>In Veldhoven en omgevingen verzorgen wij uw complete rijopleiding in onze volkswagen.
<br>Een rijopleiding met oog voor detail. U en uw behoefte staan hierbij steeds centraal.
<br>Onze ervaren instructeur geeft u een moderne rijopleiding geheel afgestemd op uw aanvangsniveau. Zo ben u altijd verzekerd van het zo mogelijk behalen van uw rijbewijs tegen een zo laag mogelijke prijs.
<br>
<br>
Klik hier voor de meest recente slagingspercentage.
</p>
</div>
<div class="contactvlak"></div>
</div>
css:
.midden
{
clear:both;
width: 100%;
height: 400px;
}
.middentextvak
{
position: relative;
display: block;
margin-left: auto;
margin-right: auto;
width: 43%;
height: 50%;
background: rgba(255, 255, 255, 0.5);
margin-top: 7%;
}
.contactvlak
{
width: 100px;
height: 100px;
background: white;
}
.middentextvak h1
{
padding-top: 2%;
padding-left: 5%;
font-family:Arial;
color: #0671ca;
font-size: 23px;
}
.middentextvak p
{
padding-left: 5%;
font-family:Arial;
margin-top: -2%;
}
.logo
{
position: absolute;
display: block;
margin-left: 15%;
margin-right: auto;
width:70%;
z-index: 0;
opacity:0.5;
clear: both;
}
Jfiddle: http://jsfiddle.net/H5LmF/9/
Edit: Sorry posted the wrong fiddle!
Add position:relative to .midden, and position:absolute and top:0 to .contactvlak.
jsFiddle example
The classes middentextvak and contactvlak are the children of class midden. Right?
So add display: inline; position: relative properties to the midden class and you will get the two divs side by side.
I'm making a website (in Dutch) and I work on a laptop with a external screen. The external screen has another resolution then my laptop screen so the site comes out distorted when viewed on the other screen. How do I fix this?
<!DOCTYPE HTML>
<html>
<head> <style type="text/css">
body {
background-color: #D8D8D8;
}
nav {
/* Dit is voor de menubalk bovenin. */
position: relative;
background-color: black;
width: 100%;
height: 110px;
top: -16px;
left: -7.8px;
padding: 8px;
}
.menutekst1 {
position: relative;
width: 150px;
display: inline;
border-color: white;
color: white;
list-style-type: none;
float: right;
font-size: 39px;
top: 10px;
right: 40px;
font-family: verdana;
}
.menutekst2 {
position: relative;
display: inline;
border-color: white;
color: white;
list-style-type: none;
float: right;
font-size: 39px;
top: 10px;
right: 25px;
font-family: verdana;
}
.menutekst3 {
position: relative;
display: inline;
border-color: white;
color: white;
list-style-type: none;
float: right;
font-size: 39px;
top: 10px;
right: 50px;
font-family: verdana;
}
.menutekst4 {
position: relative;
display: inline;
border-color: white;
color: white;
list-style-type: none;
float: right;
font-size: 39px;
top: 10px;
font-family: verdana;
}
#logo {
/* Dit is voor het logo rechts bovenin. */
position: absolute;
top: 30px;
left: 0px;
width: 300px;
}
#facebook {
/* Dit is voor het Facebook logo rechts bovenin. */
position: absolute;
top: 30px;
left: 320px;
width: 70px;
}
#hometekst {
/* Dit is voor de tekst op de home pagina. */
position: relative;
text-align: center;
font-size: 20px;
font-family: Verdana;
}
#home1 {
position: relative;
display: inline;
width: 250px;
height: 161px;
float: left;
left: 0px;
/* left: 40px; */
}
#home2 {
position: relative;
display: inline;
width: 320px;
height: 161px;
float: right;
left: px;
right: 250px; */
}
#home3 {
position: relative;
display: inline;
width: 250px;
height: 161px;
float: right;
/* right: 50px; */
}
</style>
</head>
<body>
<nav>
<ul>
<img id="logo" src="Foto/logoalgemeen.png" />
<img id="facebook" src="Foto/facebookalgemeen.png" />
<div class="menutekst4"><li>Contact </li></div>
<div class="menutekst2"><li>Wat doen wij </li></div>
<div class="menutekst3"><li>Producten</li></div>
<div class="menutekst1"><li>Home</li></div>
</ul>
</nav>
<p id="hometekst">
<strong>Welkom bij VE-Screen</strong><br>
Ve-stoffering is een betrouwbare partner, denkt met u mee<br>
en weet wat kwaliteit is of het nu gaat om uw woning, schip<br>
of kantoor.<br>
Onze kracht is de ervaring en goede samenwerking met u<br>
als klant, de interieurbouwers en andere aannemers zodat<br>
alles perfect op elkaar afgestemd en opgeleverd wordt.<br>
Desgewenst incl. stoffering van banken, het leveren van<br>
matrassen en bedtextiel en natuurlijk het plaatsen van ons<br>
eigen Ve-screen zonwering.
</p>
<img id="home3" src="Foto/home3.png" />
<img id="home2" src="Foto/home2.png" />
<img id="home1" src="Foto/home1.png" />
</body>
</html>
I think it's because you're using the width as a percentage, then positioning your buttons absolutely. This means that the 100% value will adapt to the screen size but not the buttons' positions as they will always be absolutely positioned using the same values for each screen.
One solution could be to use one precise width value, another solution would be not to absolutely position the buttons and instead use the floatproperty for the buttons. Hope this helps.