Hover does not cover whole text - html

I have a menubar in the top left corner, but the hover and the active element does not cover the whole text. I'm very new to this, and the page is not done, so no need to point out how bad it looks haha. The whole page is in norwegian, so it can be a little confusing. It is supposed to be a type of movie register, and I know its probably alot of mistakes in my code, but the problem I'm trying to figure out right now is the hover and active:)
Here is my html:
<!--MENUBAR-->
<div id="nav">
<ul class="first">
<li><a class="active" href="startside.html">Startside</a>
</li>
<li>Mine lån
</li>
<li>Min liste
</li>
</ul>
</div>
</header>
<!-- LOGIN -->
<form>
<span class='login'>
<label for="E-postadresse">E-postadresse</label>
<input name="E-postadresse" placeholder="E-postadresse" id="E-postadresse" />
<label for="Passord">Passord</label>
<input type="password" placeholder="Passord" id="Passord" />
<input type="submit" value="Logg inn" />
</span>
</form>
</body>
</html>
<!-- end snippet -->
And css:
/*MENUBAR*/
#nav {
background-color: #999999;
position: absolute;
top:0px;
padding-left: 85px;
height: 50px;
overflow: hidden;
margin-top: -5px;
left: -90px;
}
ul {
list-style-type: none;
margin: 0;
font-size: 0;
padding: 5px;
overflow: hidden;
font-family: Arial, Helvetica, sans-serif;
background-color: #808080;
}
.first li {
display: inline-block;
}
li a {
display:block;
text-decoration: none;
text-align: center;
padding: 15px 20px;
color: white;
cursor:pointer;
font-size: 16px;
}
li a:hover {
background-color:#333333;
}
.active {
background-color:#333333;
}
/* LOG IN*/
form {
float:right;
font-family: Arial, Helvetica, sans-serif;
}
.login {
position: absolute;
top: 10px;
right: 25px;
font-size: 50%;
display: inline-block;
}
input{
font-size: 90%;
}

You should delete space between li elements like this
<ul class="first">
<li><a class="active" href="startside.html">Startside</a>
</li><li>Mine lån
</li><li>Min liste</li>
</ul>
it's something like bug with space between li elements and also div if they are typed on new line.(I am sorry if explained something wrongly).

html
/*FLEXBOX*/
{
font-family: "Arsenal", "Times New Roman";
}
body {
background: #333333;
margin: 0;
}
header {
display: flex;
justify-content: center;
align-items: center;
background: #999999;
height: 50px;
padding-right: 100px;
}
/*SISTE LÅNTE*/
main {
display: flex;
justify-content: space-around;
align-items: center;
}
.main {
background: #999999;
flex-grow: 1;
order: 2;
color: white;
font-family: Arial, Helvetica, sans-serif;
}
.main h5 {
padding-left: 10px;
}
/*TILGJENGELIGE FILMER*/
.left {
background: #999999;
flex-grow: 1;
order: 1;
margin: 20px;
color: white;
font-family: Arial, Helvetica, sans-serif;
}
.left h5 {
padding-left: 10px;
}
/*ANBEFALINGER*/
.right {
background: #999999;
flex-grow: 1;
order: 3;
margin: 20px;
color: white;
font-family: Arial, Helvetica, sans-serif;
}
.left,
.right,
.main {
margin: 20px 20px;
border-style: solid;
border-color: black;
border-width: 5px 5px 5px 5px;
}
.right h5 {
padding-left: 10px;
}
/*RUTINER*/
footer {
background: #999999;
display: flex;
justify-content: flex-start;
align-items: flex-start;
height: 155px;
margin: 20px;
margin-top: 0px;
padding: 10px;
color: white;
border-style: solid;
border-color: black;
border-width: 5px 5px 5px 5px;
}
/*MENUBAR*/
#nav {
background-color: #999999;
position: absolute;
top: 0px;
padding-left: 85px;
height: 50px;
overflow: hidden;
margin-top: -5px;
left: -90px;
}
ul {
list-style-type: none;
margin: 0;
padding: 5px;
overflow: hidden;
font-family: Arial, Helvetica, sans-serif;
background-color: #999999;
}
.first li {
display: inline-block;
}
li a {
display: inline-block;
text-decoration: none;
text-align: center;
padding: 15px 20px;
color: white;
cursor: pointer;
}
li a:hover {
background-color: #ddd;
}
li a:active {
background-color: #ccc;
}
/* LOG IN*/
form {
float: right;
font-family: Arial, Helvetica, sans-serif;
}
.login {
position: absolute;
top: 10px;
right: 25px;
font-size: 50%;
display: inline-block;
}
input {
font-size: 90%;
}
/*ALLE FILMER*/
.movie1 {
display: flex;
}
.movie1 img {
padding: 10px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Arsenal" rel="stylesheet">
<link rel="stylesheet" href="Startside.css" type="text/css">
<title>Filmregister</title>
</head>
<body>
<header>
<h2>Filmregister</h2>
<!--MENUBAR-->
<div id="nav">
<ul class="first">
<li><a class="active" href="startside.html">Startside</a>
</li>
<li>Mine lån
</li>
<li>Min liste
</li>
</ul>
</div>
</header>
<!--SISTE LÅNTE-->
<main>
<div class="main">
<h5>Siste lånte</h5>
<div class="movies">
<div class="movie1">
<a href="file:///C:/Users/kodde/Desktop/Webpage%20ver2/Valkyrie.html">
<img src="valkyrie1.jpg" width="100" height="140" alt="Valkyrie">
</a>
<small>
<br>
Utgitt: 2008
<br>
Bryan Singer
<br>
Krig
<br>
Film(dvd-video)
</small>
</div>
<div class="movie1">
<a href="file:///C:/Users/kodde/Desktop/Webpage%20ver2/MinorityReport.html">
<img src="MinorityReport3.jpg" width="100" height="140" alt="MinorityReport">
</a>
<small>
<br>
Utgitt: 2002
<br>
Steven Spielberg
<br>
Sci-fi
<br>
Film(dvd-video)
</small>
</div>
</div>
</div>
<!--TILGJENGELIGE FILMER-->
<div class="left">
<h5>Tilgjengelige filmer</h5>
<div class="movies">
<div class="movie1">
<a href="file:///C:/Users/kodde/Desktop/Webpage%20ver2/The-Intouchables.html">
<img src="TheIntouchables3.jpg" width="100" height="140" alt="The-Intouchables">
</a>
<small>
<br>
Utgitt: 2011
<br>
Olivier Nakache / Eric Toledano
<br>
Drama, biografi, komedie
<br>
Film(dvd-video)
</small>
</div>
<div class="movie1">
<a href="file:///C:/Users/kodde/Desktop/Webpage%20ver2/The-Lunchbox.html?E-postadresse=">
<img src="TheLunchbox1.jpg" width="100" height="140" alt="The-Lunchbox">
</a>
<small>
<br>
Utgitt: 2013
<br>
Ritesh Batra
<br>
Romanse, komedie
<br>
Film(dvd-video)
</small>
</div>
</div>
</div>
<!--ANBEFALINGER-->
<div class="right">
<h5>Anbefalinger</h5>
<div class="movies">
<div class="movie1">
<a href="file:///C:/Users/kodde/Desktop/Webpage%20ver2/The-Intouchables.html">
<img src="TheIntouchables3.jpg" width="100" height="140" alt="The-Intouchables">
</a>
<small>
<br>
Utgitt: 2011
<br>
Olivier Nakache / Eric Toledano
<br>
Drama, biografi, komedie
<br>
Film(dvd-video)
</small>
</div>
<div class="movie1">
<a href="file:///C:/Users/kodde/Desktop/Webpage%20ver2/Valkyrie.html">
<img src="valkyrie1.jpg" width="100" height="140" alt="Valkyrie">
</a>
<small>
<br>
Utgitt: 2008
<br>
Bryan Singer
<br>
Krig
<br>
Film(dvd-video)
</small>
</div>
</div>
</div>
</main>
<!--RUTINER-->
<footer>
<strong>Rutiner</strong>
<ul id="rutiner">
<br>
<li> <small> 1. Følgende kan låne: staben ved Institutt for informasjons- og medievitenskap, studenter ved instituttet, på grunnlag av faglig begrunnelse, andre ved UiB etter særlig avtale for et avgrenset tidsrom eller for et avgrenset prosjekt.</small>
</li>
<li> <small> 2. Bestillinger vil bli effektuert hver arbeidsdag mellom klokken 14:00 og 15:00.</small>
</li>
<li><small> 3. Ansatte ved instituttet får filmen lagt i posthyllen, studenter og andre får tilbakemelding om hvor og når filmen kan hentes.</small>
</li>
<li> <small> 4. For alt utlån gjelder en generell regel om lånetid på 1 uke, som kan forlenges med ytterligere en uke. Ønskes en film lånt over en lengre periode må dette begrunnes, og hver enkelt forespørsel vil bli vurdert. </small>
</li>
<li> <small> 5. Film skal leveres tilbake i posthyllen merket retur av film.</small>
</li>
</ul>
</footer>
<!-- LOGIN -->
<form>
<span class='login'>
<label for="E-postadresse">E-postadresse</label>
<input name="E-postadresse" placeholder="E-postadresse" id="E-postadresse" />
<label for="Passord">Passord</label>
<input type="password" placeholder="Passord" id="Passord" />
<input type="submit" value="Logg inn" />
</span>
</form>
</body>
</html>

Adding a width and a height property to the anchor element should fix it:
li a { width: auto; height: auto; }
Hover effect:
li a:hover { color: #999; }
Note: the active effect is triggered whenever you click on the element. So, it won't produce any effect after the page has been reloaded.

Related

Prevent float right from breaking a line

i am trying to make a html + css website, i tried to make a right float for a span (which have the class .float ) but it's breaking a line, i want to know how can i prevent it from breaking a line? i tried display:inline-block but no addition, full code:
<html>
<head>
<title> Web page </title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
</head>
<body>
<!-- Navbar -->
<nav>
Acceuil <span> | </span>
Types d'appareils <span> | </span>
Ordinateurs <span> | </span>
Telephones <span> | </span>
O.S <span> | </span>
Etudes
</nav>
<!-- End of Navbar -->
<div class="header">
<br> <br>
<span class="pad"> Soufferez vous </span> <br> <br>
<span class="pad"> De l'utlisation </span>
<span class="not"> exagirée </span><span class="notn">de l'internet? </span>
<br> <br> <br> <br>
<img src="hey2.png">
<span class="float"> Hey </span>
</div>
</body>
</html>
css code :
body{
margin: 0;
padding: 0;
font-family: 'Raleway', sans-serif;
}
nav{
background-color: purple;
height: 55px;
padding-top: 25px;
padding-right: 20px;
border-bottom: 5px solid gray
}
nav a{
display: inline-block; /*added*/
text-decoration: none;
color:white;
font-size: 20px;
margin-left: 10px
}
nav span{
color: white;
font-size: 15px
}
.fa{
float: right;
}
.header{
background-color: purple;
height: 600px
}
h1{
padding: 0;
margin: 0
}
.header h2,h1{
display: inline-block;
color: white;
font-family: 'Raleway', sans-serif;
margin-left: 20px
}
.pad{
color: wheat;
padding-left: 15px;
font-size: 40px
}
.not{
color: red;
padding: 0;
font-size: 40px
}
.notn{
color: wheat;
font-size: 40px
}
.header img{
height: 300px
}
.float{
float: right
}
.header span{
display: inline
}
codepen.io:
https://codepen.io/badis-kerdellou/pen/NWWVpLV
I'm not sure if I'm so dumb I didn't even got the problem, but obviusly <br> breaks the line, just put the <span class="float"> Hey </span> before the <br>, like this:
<div class="header">
<br> <br>
<span class="pad"> Soufferez vous </span> <br> <br>
<span class="pad"> De l'utlisation </span>
<span class="not"> exagirée </span><span class="notn">de l'internet? </span>
<span class="float"> Hey </span> <!--Just moved it above the <br>-->
<br> <br> <br> <br>
<img src="hey2.png">

Why doesn't the text/block display when I hover over the image?

Why doesn't the text/block display when I hover over the image? I have the html/css provided below. I really dont't know why it doesn't display when I hover over the image. (I'm just trying to hover over the first image out of the four displayed)
This is the particular relevant css snippet that I tried to use to hover over the image and display text:
/* HOVER STYLES */
div#pop-up1, #pop-up2, #pop-up3, #pop-up4 {
visibility: hidden;
position: absolute;
width: 280px;
padding: 10px;
background: #eeeeee;
color: #000000;
border: 3px solid #196CE8; /*#f7923a;*/
font-size: 90%;
border-radius: 25px;
}
trigger1:hover #pop-up1 {
display: block;
opacity: 1;
}
This is the particular html snippet:
<section id="promo_area">
<article>
<div class="inner">
<div class="picDiv"><span id="trigger1"><img alt="paris" src="Paris.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up1">
<h3>Paris</h3>
<p>MUN in Paris 2013.</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger2"><img alt="Russia" src="russia.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up2">
<h3>Russia</h3>
<p>MUN in Russia 2014</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger3"><img alt="Dubai" src="dubai.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up3">
<h3>Dubai</h3>
<p>MUN in Dubai 2015</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger4"><img alt="Japan" src="japan.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up4">
<h3>Japan</h3>
<p>MUN in Japan 2016</p>
</div>
</article>
</section><!--end promo_area-->
This is the full code:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Birdwatching</title>
<!-- <link rel="stylesheet" href="style.css"> -->
<style>
html
{ height: 100%;
}
*
{ margin: 0;
padding: 0;}
body
{ font: normal .80em 'trebuchet ms', arial, sans-serif;
background: #F0EFE2 url(ff.jpg) repeat;
color: #000;
width: 97%;
min-width: 800px;
margin:0 auto;
}
p
{ padding: 0 0 20px 0;
line-height: 1.7em;}
img
{ border: 0;}
h1, h2, h3, h4, h5, h6
{ font: normal 175% 'century gothic', arial, sans-serif;
color: #7E2451;
margin: 0 0 15px 0;
padding: 15px 0 5px 0;}
h2
{ font: normal 175% 'century gothic', arial, sans-serif;}
h4, h5, h6
{ margin: 0;
padding: 0 0 5px 0;
font: normal 120% arial, sans-serif;}
h5, h6
{ font: italic 95% arial, sans-serif;
padding: 0 0 15px 0;}
nav ul {
background: url(transparent.png) ;
width: 100%;
height: 52px;
text-align: center;
padding: 0;
margin: 0;
}
nav ul li {
display: inline;
}
nav ul li a {
text-decoration: none;
color: #fff;
letter-spacing: 0.2em;
font: normal 100% arial, sans-serif;
text-align: center;
display: inline-block;
margin: 5px;
padding: 9px 26px 9px 26px;
text-transform: uppercase;
}
nav ul li a:hover {
color: #000;
background-color: #fff;
}
.dropdown {
display:inline-block;
position: relative;
}
.dropdown-content {
background: #f9f9f9;
min-width: 160px;
position: absolute;
display: none;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
left: 50%;
transform: translateX(-50%);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align:left;
}
.dropdown-content a:hover {
background: #bada55;
left:auto;
right:0;
margin-right:-10px;
}
.dropdown:hover .dropdown-content {
display: block;
}
main
{ width: 854px;
overflow: hidden;
margin: 0 auto 0 auto;
padding: 0 24px 20px 20px;
background: transparent url(transparent_light.png) repeat;}
#first_half article
{ text-align: left;
float: left;
width: 595px;
/width:60%;
height: 50pc;
padding: 0;}
#first_half article ul
{ margin: 2px 0 22px 0px;}
#first_half article ul li
{ list-style-type: none;
background: url(bullet.png) no-repeat;
margin: 0 0 6px 0;
padding: 0 0 4px 25px;
line-height: 1.5em;}
#first_half aside
{ float: right;
width: 210px;
/width: 25%;
/padding: 0 15px 20px 15px;
padding: 0;
height: 50pc;
}
#first_half aside ul
{ width: 198px;
padding: 4px 0 0 0;
margin: 4px 0 30px 0;}
#first_half aside li
{ list-style: none;
padding: 0 0 7px 0; }
#first_half aside li a, #first_half .sidebar li a:hover
{ padding: 0 0 0 40px;
display: block;
background: transparent url(link.png) no-repeat left center;}
#first_half aside li a.selected
{ color: #7E2451;
text-decoration: none;}
#promo_area article {
float:left;
width: 25%;
/height: 50pc;
padding:10px 0;
border-top: solid #f7be84;
/background:#fff;
text-align: center;
}
#promo_area article .inner {
margin:0 10px;
padding:10px;
background:#e5e8ed;
/border-radius: 25px;
box-shadow: 10px 10px 5px #888888;
text-align: center;
}
#promo_area article p {
font-family:'Open Sans Condensed';
font-weight:300;
font-size:1em;
line-height:1.5em;
color:#616161;
}
/* HOVER STYLES */
div#pop-up1, #pop-up2, #pop-up3, #pop-up4 {
visibility: hidden;
position: absolute;
width: 280px;
padding: 10px;
background: #eeeeee;
color: #000000;
border: 3px solid #196CE8; /*#f7923a;*/
font-size: 90%;
border-radius: 25px;
}
trigger1:hover #pop-up1 {
display: block;
opacity: 1;
}
</style>
</head>
<body>
<header>
<h1>Model United Nations Deforestation Conference</h1>
<img src="dove.png" alt="a simple dove logo">
<nav>
<ul>
<li>Home</li>
<li class="dropdown">Get started
<div class="dropdown-content">
Preparation
D-Day
Useful Resources
</div>
</li>
<li class="dropdown">Gallery
<div class="dropdown-content">
MUN 2015
MUN 2016
MUN 2017
</div>
</li>
<li class="dropdown">Contact Us
<div class="dropdown-content">
Ask A Question
Contact Information
Map
</div>
</li>
<li class="dropdown">Forum
<div class="dropdown-content">
About
Sign-Up
Community
</div>
</li>
</ul>
</nav>
</header>
<main>
<section id = "first_half">
<article>
<h2>Welcome</h2>
<p>Welcome to our fake birdwatching site. If this were a real site, it would be the ideal place to come to learn more about birdwatching, whether you are a beginner looking to learn how to get into birding, or an expert wanting to share ideas, tips, and photos with other like-minded people.</p>
<p>So don't waste time! Get what you need, then turn off that computer and get out into the great outdoors!</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ojcNcvb1olg" frameborder="0" allowfullscreen sandbox></iframe>
<h2>Rocking the free web</h2>
<p>Mozilla are a global community of technologists, thinkers, and builders, working together to keep the Internet alive and accessible, so people worldwide can be informed contributors and creators of the Web. We believe this act of human collaboration across an open platform is essential to individual growth and our collective future.</p>
<p>Click on the images below to find more information about the cool stuff Mozilla does. Red panda picture by Mathias Appel.</p>
</article>
<aside>
<form>
<h1>Payment form</h1>
<p>Required fields are followed by <strong><abbr title="required">*</abbr></strong>.</p>
<section>
<h2>Contact information</h2>
<fieldset>
<legend>Title</legend>
<ul>
<li>
<label for="title_1">
<input type="radio" id="title_1" name="title" value="M." >
Mister
</label>
</li>
<li>
<label for="title_2">
<input type="radio" id="title_2" name="title" value="Ms.">
Miss
</label>
</li>
</ul>
</fieldset>
<p>
<label for="name">
<span>Name: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="text" id="name" name="username">
</p>
<p>
<label for="mail">
<span>E-mail: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="email" id="mail" name="usermail">
</p>
<p>
<label for="pwd">
<span>Password: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="password" id="pwd" name="password">
</p>
</section>
<section>
<h2>Payment information</h2>
<p>
<label for="card">
<span>Card type:</span>
</label>
<select id="card" name="usercard">
<option value="visa">Visa</option>
<option value="mc">Mastercard</option>
<option value="amex">American Express</option>
</select>
</p>
<p>
<label for="number">
<span>Card number:</span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="text" id="number" name="cardnumber">
</p>
<p>
<label for="date">
<span>Expiration date:</span>
<strong><abbr title="required">*</abbr></strong>
<em>formatted as mm/yy</em>
</label>
<input type="text" id="date" name="expiration">
</p>
</section>
<p> <button type="submit">Validate the payment</button> </p>
</form>
</aside>
</section>
<section id="promo_area">
<article>
<div class="inner">
<div class="picDiv"><span id="trigger1"><img alt="paris" src="Paris.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up1">
<h3>Paris</h3>
<p>MUN in Paris 2013.</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger2"><img alt="Russia" src="russia.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up2">
<h3>Russia</h3>
<p>MUN in Russia 2014</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger3"><img alt="Dubai" src="dubai.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up3">
<h3>Dubai</h3>
<p>MUN in Dubai 2015</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger4"><img alt="Japan" src="japan.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up4">
<h3>Japan</h3>
<p>MUN in Japan 2016</p>
</div>
</article>
</section><!--end promo_area-->
</main>
</body>
</html>
First of all the css code you used to display it is not correct trigger1:hover #pop-up1 , as per you requirement i placed a simple css at the bottom , where + is used for the Adjacent sibling combinator
#promo_area article .inner:hover + div {
display: block;
visibility: visible;
}
html
{ height: 100%;
}
*
{ margin: 0;
padding: 0;}
body
{ font: normal .80em 'trebuchet ms', arial, sans-serif;
background: #F0EFE2 url(ff.jpg) repeat;
color: #000;
width: 97%;
min-width: 800px;
margin:0 auto;
}
p
{ padding: 0 0 20px 0;
line-height: 1.7em;}
img
{ border: 0;}
h1, h2, h3, h4, h5, h6
{ font: normal 175% 'century gothic', arial, sans-serif;
color: #7E2451;
margin: 0 0 15px 0;
padding: 15px 0 5px 0;}
h2
{ font: normal 175% 'century gothic', arial, sans-serif;}
h4, h5, h6
{ margin: 0;
padding: 0 0 5px 0;
font: normal 120% arial, sans-serif;}
h5, h6
{ font: italic 95% arial, sans-serif;
padding: 0 0 15px 0;}
nav ul {
background: url(transparent.png) ;
width: 100%;
height: 52px;
text-align: center;
padding: 0;
margin: 0;
}
nav ul li {
display: inline;
}
nav ul li a {
text-decoration: none;
color: #fff;
letter-spacing: 0.2em;
font: normal 100% arial, sans-serif;
text-align: center;
display: inline-block;
margin: 5px;
padding: 9px 26px 9px 26px;
text-transform: uppercase;
}
nav ul li a:hover {
color: #000;
background-color: #fff;
}
.dropdown {
display:inline-block;
position: relative;
}
.dropdown-content {
background: #f9f9f9;
min-width: 160px;
position: absolute;
display: none;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
left: 50%;
transform: translateX(-50%);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align:left;
}
.dropdown-content a:hover {
background: #bada55;
left:auto;
right:0;
margin-right:-10px;
}
.dropdown:hover .dropdown-content {
display: block;
}
main
{ width: 854px;
overflow: hidden;
margin: 0 auto 0 auto;
padding: 0 24px 20px 20px;
background: transparent url(transparent_light.png) repeat;}
#first_half article
{ text-align: left;
float: left;
width: 595px;
/width:60%;
height: 50pc;
padding: 0;}
#first_half article ul
{ margin: 2px 0 22px 0px;}
#first_half article ul li
{ list-style-type: none;
background: url(bullet.png) no-repeat;
margin: 0 0 6px 0;
padding: 0 0 4px 25px;
line-height: 1.5em;}
#first_half aside
{ float: right;
width: 210px;
/width: 25%;
/padding: 0 15px 20px 15px;
padding: 0;
height: 50pc;
}
#first_half aside ul
{ width: 198px;
padding: 4px 0 0 0;
margin: 4px 0 30px 0;}
#first_half aside li
{ list-style: none;
padding: 0 0 7px 0; }
#first_half aside li a, #first_half .sidebar li a:hover
{ padding: 0 0 0 40px;
display: block;
background: transparent url(link.png) no-repeat left center;}
#first_half aside li a.selected
{ color: #7E2451;
text-decoration: none;}
#promo_area article {
float:left;
width: 25%;
/height: 50pc;
padding:10px 0;
border-top: solid #f7be84;
/background:#fff;
text-align: center;
}
#promo_area article .inner {
margin:0 10px;
padding:10px;
background:#e5e8ed;
/border-radius: 25px;
box-shadow: 10px 10px 5px #888888;
text-align: center;
}
#promo_area article p {
font-family:'Open Sans Condensed';
font-weight:300;
font-size:1em;
line-height:1.5em;
color:#616161;
}
/* HOVER STYLES */
div#pop-up1, #pop-up2, #pop-up3, #pop-up4 {
visibility: hidden;
position: absolute;
width: 280px;
padding: 10px;
background: #eeeeee;
color: #000000;
border: 3px solid #196CE8; /*#f7923a;*/
font-size: 90%;
border-radius: 25px;
}
trigger1:hover #pop-up1 {
display: block;
opacity: 1;
}
#promo_area article .inner:hover + div {
display: block;
visibility: visible;
}
<header>
<h1>Model United Nations Deforestation Conference</h1>
<img src="dove.png" alt="a simple dove logo">
<nav>
<ul>
<li>Home</li>
<li class="dropdown">Get started
<div class="dropdown-content">
Preparation
D-Day
Useful Resources
</div>
</li>
<li class="dropdown">Gallery
<div class="dropdown-content">
MUN 2015
MUN 2016
MUN 2017
</div>
</li>
<li class="dropdown">Contact Us
<div class="dropdown-content">
Ask A Question
Contact Information
Map
</div>
</li>
<li class="dropdown">Forum
<div class="dropdown-content">
About
Sign-Up
Community
</div>
</li>
</ul>
</nav>
</header>
<main>
<section id = "first_half">
<article>
<h2>Welcome</h2>
<p>Welcome to our fake birdwatching site. If this were a real site, it would be the ideal place to come to learn more about birdwatching, whether you are a beginner looking to learn how to get into birding, or an expert wanting to share ideas, tips, and photos with other like-minded people.</p>
<p>So don't waste time! Get what you need, then turn off that computer and get out into the great outdoors!</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ojcNcvb1olg" frameborder="0" allowfullscreen sandbox></iframe>
<h2>Rocking the free web</h2>
<p>Mozilla are a global community of technologists, thinkers, and builders, working together to keep the Internet alive and accessible, so people worldwide can be informed contributors and creators of the Web. We believe this act of human collaboration across an open platform is essential to individual growth and our collective future.</p>
<p>Click on the images below to find more information about the cool stuff Mozilla does. Red panda picture by Mathias Appel.</p>
</article>
<aside>
<form>
<h1>Payment form</h1>
<p>Required fields are followed by <strong><abbr title="required">*</abbr></strong>.</p>
<section>
<h2>Contact information</h2>
<fieldset>
<legend>Title</legend>
<ul>
<li>
<label for="title_1">
<input type="radio" id="title_1" name="title" value="M." >
Mister
</label>
</li>
<li>
<label for="title_2">
<input type="radio" id="title_2" name="title" value="Ms.">
Miss
</label>
</li>
</ul>
</fieldset>
<p>
<label for="name">
<span>Name: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="text" id="name" name="username">
</p>
<p>
<label for="mail">
<span>E-mail: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="email" id="mail" name="usermail">
</p>
<p>
<label for="pwd">
<span>Password: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="password" id="pwd" name="password">
</p>
</section>
<section>
<h2>Payment information</h2>
<p>
<label for="card">
<span>Card type:</span>
</label>
<select id="card" name="usercard">
<option value="visa">Visa</option>
<option value="mc">Mastercard</option>
<option value="amex">American Express</option>
</select>
</p>
<p>
<label for="number">
<span>Card number:</span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="text" id="number" name="cardnumber">
</p>
<p>
<label for="date">
<span>Expiration date:</span>
<strong><abbr title="required">*</abbr></strong>
<em>formatted as mm/yy</em>
</label>
<input type="text" id="date" name="expiration">
</p>
</section>
<p> <button type="submit">Validate the payment</button> </p>
</form>
</aside>
</section>
<section id="promo_area">
<article>
<div class="inner">
<div class="picDiv"><span id="trigger1"><img alt="paris" src="Paris.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up1">
<h3>Paris</h3>
<p>MUN in Paris 2013.</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger2"><img alt="Russia" src="russia.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up2">
<h3>Russia</h3>
<p>MUN in Russia 2014</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger3"><img alt="Dubai" src="dubai.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up3">
<h3>Dubai</h3>
<p>MUN in Dubai 2015</p>
</div>
</article>
<article>
<div class="inner">
<div class="picDiv"><span id="trigger4"><img alt="Japan" src="japan.jpg" width="100" height="100" /></span></div>
</div>
<!-- HIDDEN / POP-UP DIV -->
<div id="pop-up4">
<h3>Japan</h3>
<p>MUN in Japan 2016</p>
</div>
</article>
</section><!--end promo_area-->
</main>

How to get these element to stay centered

I have these blocks of code that I want to stay center the entire time. But I am not sure how. I am hoping you guys could help me out here.
Here is the code
main {
width: 70%;
float: left;
clear: both;
border-right: 1px solid #331a00;
}
main ul {
margin-top: 1em;
margin: auto;
width: 100%;
margin: auto
}
.index {
float: left;
border: 3px solid #b88f61;
margin-top: 1em;
margin-right: 2em;
list-style: none;
}
main ul {
margin-left: 3em
}
.index:hover {
box-shadow: 1px 2px 3px 4px grey;
border: 3px solid #331a00;
}
.index a div h3 {
background-color: #331a00;
padding: .5em;
color: white;
text-decoration: none;
font-weight: bold;
font-size: 100%;
text-align: center;
text-decoration: underline
}
.index a {
text-decoration: none;
}
.index a div img {
width: 150px;
height: 150px;
margin-bottom: -5px
}
#mobile_index {
display: none;
}
#medusa {
background-color: white;
;
}
#intro {
width: 70%;
margin: auto;
margin-bottom: 4em;
clear: both;
font-size: 120%
}
#intro h4 {
text-align: center;
padding: 1em 0;
font-size: 150%;
}
#intro h1 a {
text-decoration: none;
}
#intro h1 {
text-align: center;
}
/*ASIDE*/
aside figure {
width: 100%
}
aside {
width: 24%;
float: right;
margin-top: 1.5em;
}
aside h3 {
font-family: "Times New Roman", serif;
font-size: 1.5em;
font-weight: bolder;
padding-bottom: .5em;
text-align: center;
}
.popular {
display: block;
background-color: #331a00;
color: white;
padding: .5em;
margin-bottom: .3em;
margin-right: .1em;
margin-left: 0;
font-weight: bold;
}
aside figure figcaption {
margin-bottom: 1em;
width: 100%;
background-color: #331a00;
color: white;
font-weight: bold;
padding: .5em 0;
font-size: 1.2vw
}
form {
width: 100%
}
input[type="submit"] {
margin: auto
}
<main>
<h1 id="page_title">The Compendium of Greek Mythology</h1>
<ul>
<li class="index">
<a href="Compendium Gods.html">
<div>
<img src="images/The Gods.jpg" alt="Gods">
<h3>Gods</h3>
</div>
</a>
</li>
<li class="index">
<a href="#" alt="Heroes">
<div>
<img src="images/The Heroes.JPG">
<h3>Heroes</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Monsters.png" id="medusa" alt="Monsters">
<h3>Beasts</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Titans.jpg" alt="The_Titans">
<h3>Titans</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Titans.jpg" alt="The_Giants">
<h3>Giants</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Gods.jpg" alt="The_Giants">
<h3>Nymphs</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Gods.jpg" alt="The_Giants">
<h3>Constellations</h3>
</div>
</a>
</li>
</ul>
</main>
<aside>
<div>
<form method="get" action="http://www.google.com/search">
<h3>Search the Compendium</h3>
<input type="search" name="q" size="" maxlength="" placeholder="Google Search">
<input type="hidden" name="domains" value="http://christiaanblom.coolpage.biz">
<input type="hidden" name="sitesearch" value="http://christiaanblom.coolpage.biz"><br>
<input type="submit" name="search" value="Search">
</form>
</div>
<div>
<h3>Popular</h3>
<p class="popular">Zeus</p>
<p class="popular">Poseidon</p>
<p class="popular">Hercules</p>
<p class="popular">Dragon</p>
<p class="popular">Cyclops</p>
<p class="popular">Ares</p>
<p class="popular">Kronos</p>
<p class="popular">Perseus</p>
<p class="popular">Giants</p>
<p class="popular">Gaia</p>
<p class="popular">Oranos</p>
</div>
</aside>
Right now, the .index list items are staying on the left hand side of the main element. I've tried various things, but none of them worked out, which is why I am coming to you guys.
Remove padding and margin from <ul>, add text-align:center;
Remove the float:left; from .index and add display:inline-block;
main {
width: 70%;
float: left;
clear: both;
border-right: 1px solid #331a00;
}
main ul {
margin-top: 1em;
margin: auto;
width: 100%;
margin: auto;
}
/* Remove the float: left; from .index and add display: inline-block; */
.index {
display: inline-block;
border: 3px solid #b88f61;
margin-top: 1em;
margin-right: 2em;
list-style: none;
}
/* Remove padding and margin from UL, add text-align:center; */
main ul {
margin-left: 0;
padding-left: 0;
text-align: center;
}
.index:hover {
box-shadow: 1px 2px 3px 4px grey;
border: 3px solid #331a00;
}
.index a div h3 {
background-color: #331a00;
padding: .5em;
color: white;
text-decoration: none;
font-weight: bold;
font-size: 100%;
text-align: center;
text-decoration: underline;
}
.index a {
text-decoration: none;
}
.index a div img {
width: 150px;
height: 150px;
margin-bottom: -5px
}
#mobile_index {
display: none;
}
#medusa {
background-color: white; /* Removed extra ; */
}
#intro {
width: 70%;
margin: auto;
margin-bottom: 4em;
clear: both;
font-size: 120%;
}
#intro h4 {
text-align: center;
padding: 1em 0;
font-size: 150%;
}
#intro h1 a {
text-decoration: none;
}
#intro h1 {
text-align: center;
}
/*ASIDE*/
aside figure {
width: 100%
}
aside {
width: 24%;
float: right;
margin-top: 1.5em;
}
aside h3 {
font-family: "Times New Roman", serif;
font-size: 1.5em;
font-weight: bolder;
padding-bottom: .5em;
text-align: center;
}
.popular {
display: block;
background-color: #331a00;
color: white;
padding: .5em;
margin-bottom: .3em;
margin-right: .1em;
margin-left: 0;
font-weight: bold;
}
aside figure figcaption {
margin-bottom: 1em;
width: 100%;
background-color: #331a00;
color: white;
font-weight: bold;
padding: .5em 0;
font-size: 1.2vw
}
form {
width: 100%
}
input[type="submit"] {
margin: auto
}
<main>
<h1 id="page_title">The Compendium of Greek Mythology</h1>
<ul>
<li class="index">
<a href="Compendium Gods.html">
<div>
<img src="images/The Gods.jpg" alt="Gods">
<h3>Gods</h3>
</div>
</a>
</li>
<li class="index">
<a href="#" alt="Heroes">
<div>
<img src="images/The Heroes.JPG">
<h3>Heroes</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Monsters.png" id="medusa" alt="Monsters">
<h3>Beasts</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Titans.jpg" alt="The_Titans">
<h3>Titans</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Titans.jpg" alt="The_Giants">
<h3>Giants</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Gods.jpg" alt="The_Giants">
<h3>Nymphs</h3>
</div>
</a>
</li>
<li class="index">
<a href="#">
<div>
<img src="images/The Gods.jpg" alt="The_Giants">
<h3>Constellations</h3>
</div>
</a>
</li>
</ul>
</main>
<aside>
<div>
<form method="get" action="http://www.google.com/search">
<h3>Search the Compendium</h3>
<input type="search" name="q" size="" maxlength="" placeholder="Google Search">
<input type="hidden" name="domains" value="http://christiaanblom.coolpage.biz">
<input type="hidden" name="sitesearch" value="http://christiaanblom.coolpage.biz"><br>
<input type="submit" name="search" value="Search">
</form>
</div>
<div>
<h3>Popular</h3>
<p class="popular">Zeus</p>
<p class="popular">Poseidon</p>
<p class="popular">Hercules</p>
<p class="popular">Dragon</p>
<p class="popular">Cyclops</p>
<p class="popular">Ares</p>
<p class="popular">Kronos</p>
<p class="popular">Perseus</p>
<p class="popular">Giants</p>
<p class="popular">Gaia</p>
<p class="popular">Oranos</p>
</div>
</aside>

HTML - Text is not inside the button

I'm new here. I just wanted to ask about this problem.
The text is not inside the box The text seems to be outside of the box and it looks weird. How do I make the text appear inside the box? What did I do wrong in the coding? I don't see any problem in my coding. By the way, I use Dreamweaver to code this interface.
HTML code:
<html>
<head>
<meta charset="utf-8">
<title>Deane.co</title>
<link href="style.css" rel="stylesheet" type="text/css" >
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="nav1">
<h4><h1>Deane.co</h4>
<ul>
<li id="active"><a href="index.html"</a>Home</li>
<li><a href="service.html"</a>Products</li>
<li><a href="contact.html"</a>Contact</li>
<li><a href="about.html"About</a>About</li>
</ul>
</div>
<div id="main-content">
<br>
<h1> Welcome To Deane.co </h1>
<br>
<p> Welcome to Deane.co the place to shop beautiful clothes easier </p>
<br>
<div id = "products">
<h5>Check our products</h5>
</div>
</div>
<div id="shirtsaesthetic">
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
</div>
<div id="footer">
<h2>© Allright Reserved</h2>
<div>
<ul>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-instagram"></i></li>
</ul>
</div>
</div>
</body>
</html>
CSS code:
body {
font-family: 'Raleway', sans-serif;
}
*{
padding: 0px;
margin: 0px;
}
#nav1 {
width: 100%;
height: 70px;
line-height: 70px;
background: #a5aab1;
}
#nav1 h1 {
float: left;
font-size: 2.5em;
margin-left: 15px;
}
#nav1 h1 a {
text-decoration: none;
color: white;
}
#nav1 ul {
float: right;
margin-right: 15px;
}
#nav1 ul li {
display: inline-block;
list-style-type: none;
}
#nav1 ul li a {
text-decoration: none;
color: white;
padding: 25px;
}
#nav1 ul li:hover{
background: #bfc5ce;
transition: all ease-in-out 0.45s;
}
#active {
background: #bfc5ce;
}
#main-content {
width: 100&;
height: 600px;
background: url(Images/store-background3.jpg) no-repeat;
background-size: cover;
text-align: center;
color: black;
line-height: 40px;
}
#main-content a {
text-decoration: none;
color: black;
}
#products {
background: #a5aab1;
width: 170px;
height: 60px;
line-height: 60px;
margin-left: auto;
margin-right: auto;
border-radius: 5px;
color: white;
font-weight: 100;
}
#products:hover {
box-shadow: 1px 1px 10px 10px rgba(136, 131, 131, 0.83);
transition: all ease-in-out 0.45s;
}
#products a {
color: white;
text-decoration: none;
padding: 25px;
}
#shirtsaesthetic {
width: 100%;
height: 400px;
background: white;
}
#shirtsaesthetic1 {
width: 400px;
height: 300px;
padding: 5px;
display: inline;
float: left;
margin: 19px;
text-align: center;
}
#shirtsaesthetic1 img {
width: 300px;
height: 220px;
border-radius: 5px;
}
your first bits of code are messed up.
Close tags properly:
<head>
<title>Deane.co</title>
<link href="style.css" rel="stylesheet" type="text/css" >
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="nav1">
<h4><h1>Deane.co</h1></h4>
<ul>
<li id="active">Home</li>
<li>Products</li>
<li>Contact</li>
<li><a href="about.html"About>About</a></li>
</ul>
<div id="main-content">
<br>
<h1> Welcome To Deane.co </h1>
<br>
<p> Welcome to Deane.co the place to shop beautiful clothes easier </p>
<br>
<div id = "products">
<h5>Check our products</h5>
</div>
</div>
<div id="shirtsaesthetic">
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
</div>
<div id="footer">
<h2>© Allright Reserved</h2>
<div>
<ul>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-instagram"></i></li>
</ul>
</div>
</div>
</body>
In your style.css file, remove the line below:
#products a {
color: white;
text-decoration: none;
padding: 25px; //remove this line
}
In your html file, you missed ">" of a tag in these line:
<ul>
<li id="active">Home</li>
<li>Products</li>
<li> Contact</li>
<li>About</li>
</ul>
The a tags in your navigation are wrong, and you need to remove the padding from #products a
body {
font-family: 'Raleway', sans-serif;
}
*{
padding: 0px;
margin: 0px;
}
#nav1 {
width: 100%;
height: 70px;
line-height: 70px;
background: #a5aab1;
}
#nav1 h1 {
float: left;
font-size: 2.5em;
margin-left: 15px;
}
#nav1 h1 a {
text-decoration: none;
color: white;
}
#nav1 ul {
float: right;
margin-right: 15px;
}
#nav1 ul li {
display: inline-block;
list-style-type: none;
}
#nav1 ul li a {
text-decoration: none;
color: white;
padding: 25px;
}
#nav1 ul li:hover{
background: #bfc5ce;
transition: all ease-in-out 0.45s;
}
#active {
background: #bfc5ce;
}
#main-content {
width: 100&;
height: 600px;
background: url(Images/store-background3.jpg) no-repeat;
background-size: cover;
text-align: center;
color: black;
line-height: 40px;
}
#main-content a {
text-decoration: none;
color: black;
}
#products {
background: #a5aab1;
width: 170px;
height: 60px;
line-height: 60px;
margin-left: auto;
margin-right: auto;
border-radius: 5px;
color: white;
font-weight: 100;
}
#products:hover {
box-shadow: 1px 1px 10px 10px rgba(136, 131, 131, 0.83);
transition: all ease-in-out 0.45s;
}
#products a {
color: white;
text-decoration: none;
}
#shirtsaesthetic {
width: 100%;
height: 400px;
background: white;
}
#shirtsaesthetic1 {
width: 400px;
height: 300px;
padding: 5px;
display: inline;
float: left;
margin: 19px;
text-align: center;
}
#shirtsaesthetic1 img {
width: 300px;
height: 220px;
border-radius: 5px;
}
<html>
<head>
<meta charset="utf-8">
<title>Deane.co</title>
<link href="style.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="nav1">
<h4><h1>Deane.co</h4>
<ul>
<li id="active">Home </li>
<li>Products</li>
<li>Contact</li>
<li>About</li>
</ul>
</div>
<div id="main-content">
<br>
<h1> Welcome To Deane.co </h1>
<br>
<p> Welcome to Deane.co the place to shop beautiful clothes easier </p>
<br>
<div id="products">
<h5>Check our products</h5>
</div>
</div>
<div id="shirtsaesthetic">
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
<div id="shirtsaesthetic1"> <img src="Images/shirtsaesthetic.jpg"> <br>
<h4> Hipster Blouse </h4> <br>
<p> RM40 </p>
</div>
</div>
<div id="footer">
<h2>© Allright Reserved</h2>
<div>
<ul>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-instagram"></i></li>
</ul>
</div>
</div>
</body>
</html>
Your tags in the first unordered list are not closed properly.

Center 3 images evenly on page

I have a main page of my site
And I have been trying to get the images to be even spaced and centered on the page but have been failing.
{
padding: 50px;
font-family: sans-serif;
color: #666;
line-height: 18px;
font-size: 12px;
}
a
{
color: #06f;
text-decoration: none;
}
a:hover
{
text-decoration: underline;
}
.button
{
background-color: #eaeaea;
padding: 5px 9px;
display: inline-block;
color: #06f;
font-weight: normal;
border-radius: 2px;
cursor: pointer;
border: none;
font-family: sans-serif;
font-size: 12px;
text-decoration: none;
}
.button:hover
{
background-color: #06f;
color: #fff;
}
.headline
{
font-size: 12px;
color: #333;
margin-bottom: 10px;
}
.content
{
max-width: 650px;
}
.grid-wrapper
{
float: left;
margin-top: 30px;
padding-left: 125px;
}
.grid-item
{
display: block;
float: left;
width: 100%;
padding-top: 25%;
max-width: 250px;
}
.grid-content
{
padding: 10px;
}
.grid-image-link
{
display: block;
height: 290px;
}
.grid-image
{
display: block;
width: 100%;
height: 290px;
}
#albumView{
text-align: center;
background-color: #000000;
}
#indexMain{
text-align: center;
}
<body>
<div>
<ul class="grid-wrapper">
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="triangulation/triangulation.html">
<img class="grid-image" src="http://placehold.it/290x290"/>
</a>
<p>
repository on github
</p>
</div>
</li>
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="distort-grid/distort-grid.html">
<img class="grid-image" src="http://placehold.it/290x290" alt="manipulated image of president lincoln" />
</a>
<p>
repository on github
</p>
</div>
</li>
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="contrastdistort/contrastdistort.html">
<img class="grid-image" src="http://placehold.it/290x290" />
</a>
<p>
repository on github
</p>
</div>
</li>
</ul>
</div>
</body>
I have attempted to use % to get it just right, but it never seems to adjust correctly.
I am stumped and could use some help, is there anything I am missing?
Thanks
you can use display:flex and to evenly space it justify-content:space-between and to center it use margin:auto
check this snippet
body {
padding: 50px;
font-family: sans-serif;
color: #666;
line-height: 18px;
font-size: 12px;
}
div {
width: 300px;
margin: auto;
}
ul {
display: flex;
justify-content: space-between;
list-style-type: none;
}
<body>
<div>
<ul class="grid-wrapper">
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="triangulation/triangulation.html">
<img class="grid-image" src="http://placehold.it/290x290" />
</a>
<p>
repository on github
</p>
</div>
</li>
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="distort-grid/distort-grid.html">
<img class="grid-image" src="http://placehold.it/290x290" alt="manipulated image of president lincoln" />
</a>
<p>
repository on github
</p>
</div>
</li>
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="contrastdistort/contrastdistort.html">
<img class="grid-image" src="http://placehold.it/290x290" />
</a>
<p>
repository on github
</p>
</div>
</li>
</ul>
</div>
</body>
Hope it helps
Remove float:left from both ul and li and add padding:0; in ul
body
{
padding: 50px;
font-family: sans-serif;
color: #666;
line-height: 18px;
font-size: 12px;
}
a
{
color: #06f;
text-decoration: none;
}
a:hover
{
text-decoration: underline;
}
.button
{
background-color: #eaeaea;
padding: 5px 9px;
display: inline-block;
color: #06f;
font-weight: normal;
border-radius: 2px;
cursor: pointer;
border: none;
font-family: sans-serif;
font-size: 12px;
text-decoration: none;
}
.button:hover
{
background-color: #06f;
color: #fff;
}
.headline
{
font-size: 12px;
color: #333;
margin-bottom: 10px;
}
.content
{
max-width: 650px;
}
.grid-wrapper
{/*
float: left;*/
padding:0;
margin-top: 30px;
padding-left: 125px;
}
.grid-item
{
display: block;/*
float: left;*/
width: 100%;
padding-top: 25%;
max-width: 250px;
}
.grid-content
{
padding: 10px;
}
.grid-image-link
{
display: block;
height: 290px;
}
.grid-image
{
display: block;
width: 100%;
height: 290px;
}
#albumView{
text-align: center;
background-color: #000000;
}
#indexMain{
text-align: center;
}
<body>
<div>
<ul class="grid-wrapper">
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="triangulation/triangulation.html">
<img class="grid-image" src="http://placehold.it/290x290"/>
</a>
<p>
repository on github
</p>
</div>
</li>
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="distort-grid/distort-grid.html">
<img class="grid-image" src="http://placehold.it/290x290" alt="manipulated image of president lincoln" />
</a>
<p>
repository on github
</p>
</div>
</li>
<li class="grid-item">
<div class="grid-content">
<a class="grid-image-link" href="contrastdistort/contrastdistort.html">
<img class="grid-image" src="http://placehold.it/290x290" />
</a>
<p>
repository on github
</p>
</div>
</li>
</ul>
</div>
</body>