When I’m trying to put my H1 more down and to the left of the picture (like you can do in word) it stays on top of the page and shifts the whole navigation bar down etc. I tried it with margin-top: down
; but that wouldn’t work. also I want to let the underline appear with an fade when hovering over it in the nav bar but that wouldn’t work either.
body {
display: block;
background-color: black;
}
/*Navigation Menu*/
ul {
display: block;
list-style-type: none;
text-align: center;
margin: 0;
padding: 0;
}
ul li a {
display: block;
text-decoration: none;
color: white;
float: left;
margin-left: 50px;
margin-top: 30px;
font-size: 20px;
transition: 1s ease-out;
/*Transition for animation*/
}
.active {
display: block;
color: rgb(255, 0, 0);
text-decoration: underline;
}
/*On hover animation*/
ul li a:hover {
display: block;
text-decoration: underline;
}
/*Images Home page*/
.IMG1TEXT {
margin-top: 100px;
color: white;
}
.IMG1 {
margin-top: 100px;
float: right;
margin-right: 50px;
border: 5px solid white;
}
<body>
<!--Navigation-->
<nav>
<ul>
<li><a class="active" href="#">Photo's</a></li>
<li><a href="#">Films</a></li>
<li><a href="#">Trips</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<h1 class="IMG1TEXT">Portofino, </h1>
<img class="IMG1" src="img/Portofino1.png" height="350">
</body>
please help and this is some text because my post is mostly code so had to type something ig.
2
Answers
Here is how you can manage your page layout using Flexbox.
Here is documentation on flexbox
I guess you are trying to get your
<h1>
tag down from thenav
tab and to place on left of the image.Changes made:
nav
tab is styled.h1
and theimg
tag are put into a singlediv
.Following these steps you will acheive your target.