https://codepen.io/markoslk/pen/qNgWGN
h1 {
color: white;
font-size: 90px;
text-align: center;
width: 950px;
height: 100px;
margin: auto;
margin-top: 20px;
border-radius: 5px;
background-color: darkblue;
}
#slogan {
font-size: 40px;
text-align: center;
margin: auto;
margin-top: -3px;
font-family: Agency FB;
width: 940px;
height: 50px;
background-color: white;
border: 5px solid darkblue;
}
#table {
display: inline-block;
width: 225px;
height: 170px;
margin-top: 59.25px;
margin-left: 59.25px;
text-align: left;
background-color: #c0c0c0;
color: white;
border-radius: 5px;
}
.content {
text-align: center;
border-radius: 5px;
background-color: darkblue;
}
ul {
font-family: Georgia;
text-decoration: none;
list-style-type: none;
padding: 0px;
margin: 0px;
margin-top: -10px;
margin-left: 10px;
}
a {
text-decoration: none;
color: white;
}
.div {
width: 940px;
height: 525px;
margin: auto;
border-radius: 5px;
background-color: white;
border: 5px solid darkblue;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}
img {
width: 25px;
height: 25px;
padding-right: 10px;
}
<h1>NBA 2016</h1>
<p id="slogan"><i>Basketball never stops</i>
</p>
<div class="div">
<div id="table">
<h2 class="content">Atlantic</h2>
<ul>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/bos.png&h=25&w=25">Boston Celtics
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/bkn.png&h=25&w=25">Brooklyn Nets
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/ny.png&h=25&w=25">New York Knicks
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/phi.png&h=25&w=25">Philadelphia 76ers
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/tor.png&h=25&w=25">Toronto Raptors
</li>
</ul>
</div>
<div id="table">
<h2 class="content">Central</h2>
<ul>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/chi.png&h=25&w=25">Chicago Bulls
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/cle.png&h=25&w=25">Cleveland Cavaliers
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/det.png&h=25&w=25">Detroit Pistons
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/ind.png&h=25&w=25">Indiana Pacers
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/mil.png&h=25&w=25">Milwaukee Bucks
</li>
</ul>
</div>
<div id="table">
<h2 class="content">Northwest</h2>
<ul>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/den.png&h=25&w=25">Denver Nuggets
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/min.png&h=25&w=25">Minnesota Timberwolves
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/okc.png&h=25&w=25">Oklahoma City Thunder
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/por.png&h=25&w=25">Portland Trail Blazers
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/utah.png&h=25&w=25">Utah Jazz
</li>
</ul>
</div>
<div id="table">
<h2 class="content">Pacific</h2>
<ul>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/gsw.png&h=25&w=25">Golden State Warriors
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/lac.png&h=25&w=25">LA Clippers
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/lal.png&h=25&w=25">Los Angeles Lakers
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/pho.png&h=25&w=25">Phoenix Suns
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/sac.png&h=25&w=25">Sacramento Kings
</li>
</ul>
</div>
<div id="table">
<h2 class="content">Southeast</h2>
<ul>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/atl.png&h=25&w=25">Atlanta Hawks
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/cha.png&h=25&w=25">Charlotte Hornets
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/mia.png&h=25&w=25">Miami Heat
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/orl.png&h=25&w=25">Orlando Magic
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/was.png&h=25&w=25">Washington Wizards
</li>
</ul>
</div>
<div id="table">
<h2 class="content">Southwest</h2>
<ul>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/dal.png&h=25&w=25">Dallas Mavericks
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/hou.png&h=25&w=25">Houston Rockets
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/mem.png&h=25&w=25">Memphis Grizzlies
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/no.png&h=25&w=25">New Orleans Pelicans
</li>
<li>
<img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/sas.png&h=25&w=25">San Antonio Spurs
</li>
</ul>
</div>
</div>
Rest of the code is on codepen link. There seems to be some padding or something on the top of my divs. There wasn't one until I used display: inline-block. I can fit in the title of each div but that would have to be done with setting the adequate margin to it. But I don't want to move gray area,I want it to be where it is because I tried to center it as much as possible. (Is there more efficient way to do it? I did it by calculating margins and dividing. Basically I want all margins to be the same (bottom,top,right,left)) I want title,along with the list to go a bit up to fit the gray area perfectly. How can I do it?
There is a default margin on the h2 element.
When you remove the top margin from the h2 element, you get the desired result.
CSS
h2 {
margin-top: 0;
}
Codepen link
The issue you're facing is not caused by a padding, but a margin-top in your h2 element that exists by default. You can use the following CSS code to alleviate it:
.content {
margin-top: 0;
}
Codepen: → here.
Snippet:
h1 {
color: white;
font-size: 90px;
text-align: center;
width: 950px;
height: 100px;
margin: auto;
margin-top: 20px;
border-radius: 5px;
background-color: darkblue;
}
#slogan {
font-size: 40px;
text-align: center;
margin: auto;
margin-top: -3px;
font-family: Agency FB;
width: 940px;
height: 50px;
background-color: white;
border: 5px solid darkblue;
}
#table {
display: inline-block;
width: 225px;
height: 170px;
margin-top: 59.25px;
margin-left: 59.25px;
text-align: left;
background-color: #c0c0c0;
color: white;
border-radius: 5px;
}
.content {
margin-top:0;
text-align: center;
border-radius: 5px;
background-color: darkblue;
}
ul {
font-family: Georgia;
text-decoration: none;
list-style-type: none;
padding: 0px;
margin: 0px;
margin-top: -10px;
margin-left: 10px;
}
a {
text-decoration: none;
color: white;
}
.div {
width: 940px;
height: 525px;
margin: auto;
border-radius: 5px;
background-color: white;
border: 5px solid darkblue;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}
img {
width: 25px;
height: 25px;
padding-right: 10px;
}
</head>
<body>
<h1>NBA 2016</h1>
<p id="slogan"><i>Basketball never stops</i></p>
<div class="div">
<div id="table">
<h2 class="content">Atlantic</h2>
<ul><li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/bos.png&h=25&w=25">Boston Celtics</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/bkn.png&h=25&w=25">Brooklyn Nets</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/ny.png&h=25&w=25">New York Knicks</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/phi.png&h=25&w=25">Philadelphia 76ers</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/tor.png&h=25&w=25">Toronto Raptors</li></ul>
</div>
<div id="table">
<h2 class="content">Central</h2>
<ul><li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/chi.png&h=25&w=25">Chicago Bulls</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/cle.png&h=25&w=25">Cleveland Cavaliers</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/det.png&h=25&w=25">Detroit Pistons</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/ind.png&h=25&w=25">Indiana Pacers</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/mil.png&h=25&w=25">Milwaukee Bucks</li></ul>
</div>
<div id="table">
<h2 class="content">Northwest</h2>
<ul><li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/den.png&h=25&w=25">Denver Nuggets</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/min.png&h=25&w=25">Minnesota Timberwolves</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/okc.png&h=25&w=25">Oklahoma City Thunder</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/por.png&h=25&w=25">Portland Trail Blazers</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/utah.png&h=25&w=25">Utah Jazz</li></ul>
</div>
<div id="table">
<h2 class="content">Pacific</h2>
<ul><li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/gsw.png&h=25&w=25">Golden State Warriors</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/lac.png&h=25&w=25">LA Clippers</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/lal.png&h=25&w=25">Los Angeles Lakers</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/pho.png&h=25&w=25">Phoenix Suns</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/sac.png&h=25&w=25">Sacramento Kings</li></ul>
</div>
<div id="table">
<h2 class="content">Southeast</h2>
<ul><li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/atl.png&h=25&w=25">Atlanta Hawks</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/cha.png&h=25&w=25">Charlotte Hornets</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/mia.png&h=25&w=25">Miami Heat</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/orl.png&h=25&w=25">Orlando Magic</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/was.png&h=25&w=25">Washington Wizards</li></ul>
</div>
<div id="table">
<h2 class="content">Southwest</h2>
<ul><li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/dal.png&h=25&w=25">Dallas Mavericks</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/hou.png&h=25&w=25">Houston Rockets</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/mem.png&h=25&w=25">Memphis Grizzlies</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/no.png&h=25&w=25">New Orleans Pelicans</li>
<li><img style="vertical-align:middle" src="http://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/sas.png&h=25&w=25">San Antonio Spurs</li></ul>
</div>
</div>
</body>
</html>
You just need to remove the margin from the content header. You can target a specific margin using the top,left, right or bottom. In this case you need to target the margin-top of the h2 tag.
.content {
text-align:center;
border-radius:5px;
background-color:darkblue;
margin-top:0; /*This is the added property*/
}
Is this what you're looking for? https://codepen.io/anon/pen/ZOwEGE
Also it's a good idea to use the web inspector (F12) in the browser to find out whats affecting your elements.
If I understand you well, you want something lie this:
https://codepen.io/bra1N/pen/YWBzXx
CSS:
h1 {
color: white;
font-size: 90px;
text-align: center;
width: 1048px;
height: 100px;
margin: auto;
margin-top: 20px;
border-radius: 5px;
background-color: darkblue;
}
#slogan {
font-size: 40px;
text-align: center;
margin: auto;
margin-top: -3px;
font-family: Agency FB;
width: 1040px;
height: 50px;
background-color: white;
border: 5px solid darkblue;
}
#table {
display: inline-block;
width: 225px;
height: 170px;
margin-top: 59.25px;
margin-left: 59.25px;
text-align: left;
background-color: #c0c0c0;
color: white;
padding: 20px;
border-radius: 5px;
}
.content {
text-align: center;
border-radius: 5px;
background-color: darkblue;
}
ul {
font-family: Georgia;
text-decoration: none;
list-style-type: none;
padding: 0px;
margin: 0px;
margin-top: -10px;
margin-left: 10px;
}
a {
text-decoration: none;
color: white;
}
.div {
width: 1040px;
height: 525px;
margin: auto;
border-radius: 5px;
background-color: white;
border: 5px solid darkblue;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}
img {
width: 25px;
height: 25px;
padding-right: 10px;
}
Related
I am new to the CSS and HTML world and am struggling with my content overlapping whenever I resize my browser. If someone could take a look at my code and help me understand how to fix this issue that would help a lot! Thank you!
HTML:
<!doctype html>
<html>
<head>
<link href="java.js" rel="alternate stylesheet" type="text/javascript">
<link href="stylessheet.css" rel="stylesheet" type="text/css">
<meta charset="utf-8">
<link href="gallery/src/paintwithlight/lightbox.css" rel="stylesheet">
<title>Neon Angels</title>
</head>
<body class="fix">
<div id="wrapper">
<div class="section black" id="section1">
<h2 id="welcome">The Neon Angels Welcome You!
<img src="wingslogo.svg" alt="" id="top">
<img src="wingslogo.svg" alt="" id="top2">
</h2>
<p>
<img src="wings.jpg" alt="wings" width="750" id="wings">
</p>
<ul class="nav">
<li>About Us</li>
<li>Painting with Light</li>
<li>Portraits</li>
<li>Nature</li>
<li>Contact Us</li>
</ul>
<div class="mouse">
<div class="mouse-icon">
<span class="mouse-wheel"></span>
</div>
</div>
</div>
<div class="section about" id="section2">
<h2 id="abouthead">About the Neon Angels</h2>
<p id="about">
The Neon Angels specialize in painting with light photography. We absolutely love that our job consist of playing in the dark with glow sticks for hours. Our motto at Neon Angels is: "Even when it gets dark do not forget that you can glow". We are a unique company that loves abstract art, but we also do nature photography and portraits. Below you will find a video showing the process of how we work.
</p>
<iframe width="620" height="415" src="https://www.youtube.com/embed/Xzjy6kTZxW0" frameborder="0" allowfullscreen></iframe>
<ul class="nav">
<li>Welcome</li>
<li>Painting with Light</li>
<li>Portraits</li>
<li>Nature</li>
<li>Contact Us</li>
</ul>
<div class="mouse">
<div class="mouse-icon" >
<span class="mouse-wheel" id="blackmouse"></span>
</div>
</div>
</div>
<div class="section paint" id="section3">
<h2 id="painthead">Painting with Light</h2>
<p id="painting">
Painting with light is an art that takes time and rhythm. Normally we handle our sessions jamming out to music because it requires a type of rhythmic nature that only arises like when music is involved. Please feel free to look through any of our pictures and if you too would like a painting session please visit our contact page.
</p>
<div id="paintpic">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/angelin.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/abstract.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/anna.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/blue_light.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/butterfly.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/clash.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/craze.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/flower.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/greenswirl.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/halfcircle.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/mindblown.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/mystic.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/radiation.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/rainbow.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/stuckcircle.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/swirl.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/whitelight.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/wings.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/yellow-blue.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/zeus.jpg" width="300" height="200">
</div>
<ul class="nav">
<li>Welcome</li>
<li>About Us</li>
<li>Nature</li>
<li>Portraits</li>
<li>Contact Us</li>
</ul>
<div class="mouse">
<div class="mouse-icon">
<span class="mouse-wheel"></span>
</div>
</div>
</div>
<div class="section nature" id="section4">
<h2 id="naturehead">Nature</h2>
<p id="nature">
The reason why Neon Angels takes on nature photography is to always find the most unique perspectives. There are many places on Earth that the human eye neglects to see and that is where photography comes in.
</div>
<ul class="nav">
<li>Welcome</li>
<li>About Us </li>
<li>Painting with Light</li>
<li>Portraits</li>
<li>Contact Us</li>
</ul>
<div class="mouse">
<div class="mouse-icon" >
<span class="mouse-wheel" id="blackmouse"></span>
</div>
</div>
</div>
<div class="section portraits" id="section5">
<h2 id="portraithead">Portraits</h2>
<p id="port">
Neon Angels Photography would love to capture you in the light. </br>
Please check out our portraits for what we could do for you!
</p>
<div id="portpic">
<img class="gallery" src="gallery/src/Portraits/JPEG/IMG_0679.jpg" width="200" height="300">
<img class="gallery" src="gallery/src/Portraits/JPEG/IMG_0789.jpg" width="200" height="300">
<img class="gallery" src="gallery/src/Portraits/JPEG/IMG_0793.jpg" width="200" height="300">
<img class="gallery" src="gallery/src/Portraits/JPEG/IMG_3202.jpg" width="200" height="300">
<img class="gallery" src="gallery/src/Portraits/JPEG/IMG_0986.jpg" width="300" height="200">
<img class="gallery" src="gallery/src/Portraits/JPEG/IMG_4945.jpg" width="200" height="300">
</div>
<ul class="nav">
<li>Welcome</li>
<li>About Us</li>
<li>Painting with Light</li>
<li>Nature</li>
<li>Contact Us </li>
</ul>
<div class="mouse">
<div class="mouse-icon">
<span class="mouse-wheel"></span>
</div>
</div>
</div>
<div class="section contact" id="section6">
<h2 id="contacthead">Contact Neon Angels</h2>
<p id="paracontact">
The Neon Angels take pride in delivering the most unique photographs around and we would love to have you as a client. Please contact Neon Angels for any quetions about paint with light photography or a consult. Thank you!
</p>
<div id="last">
<img class="gallery" src="gallery/src/paintwithlight/JPEG/anna.jpg" width="900" height="700">
</div>
<p> Phone Number: 859-772-2156
</br>
Email: neonangels#gmail.com
</p>
<ul class="nav">
<li>Welcome</li>
<li>About Us</li>
<li>Painting with Light</li>
<li>Nature</li>
<li>Portraits</li>
</ul>
<div class="mouse">
<div class="mouse-icon" >
<span class="mouse-wheel" id="blackmouse"></span>
</div>
</div>
</div>
<footer> <div id="parawork"><i>Copyright © May 2nd, 2016</i> | <i>Neon Angels Photography</i></div> <img src="wingslogo-white2.svg" alt="" id="bottom">
<img src="wingslogo-white2.svg" alt="" id="bottom2">
</br>
<i>Email: neonangelsphotography#gmail.com</i>
</br>
</br>
<i> Phone Number: 859-772-2156</i>
</footer>
</div>
<script src="gallery/src/js/lightbox.js"></script>
</body>
</html>
CSS:
#charset "utf-8";
*{
margin:0;
padding:0;
}
body{
font-family:aguafina-script;
font-size: 34px;
font-style: italic;
letter-spacing:-1px;
}
#wrapper{
width: 100%;
margin: 0 auto;
}
.section{
text-shadow: 1px 1px 2px #f0f0f0;
text-align: center;
}
#top{
width: 100px;
height: 100px;
float: right;
}
#top2{
width: 100px;
height: 100px;
float: left;
}
#port{
margin-left: 300px;
margin-right: 300px;
padding-top: 25px;
}
#paracontact{
margin-left: 300px;
margin-right: 300px;
padding-top: 25px;
}
.section p#about{
color:#000000;
}
.section h2#abouthead{
background:#00FFE3;
padding: 50px;
}
.section h2#naturehead{
background:#00FFE3;
padding: 50px;
color: black;
}
.section #welcome{
background: #00FFE3;
color:#000000;
border-bottom: thick solid #00FFE3;
border-bottom-width: 30px;
padding-top: 10px;
}
.black{
height: 1200px;
background: black;
}
.contact{
background: #00FFE3;
color:#000000;
border-bottom: thick solid #00FFE3;
border-bottom-width: 30px;
padding-top: 10px;
letter-spacing: .25px;
line-height: 40px;
}
.nature{
height: 1600px;
background: #00FFE3;
color:#000000;
border-bottom: thick solid #00FFE3;
border-bottom-width: 30px;
padding-top: 10px;
letter-spacing:.25px;
line-height: 40px;
}
.about{
color:#000;
background:#00FFE3;
height: 1400px;
letter-spacing: .25px;
line-height: 40px;
}
#about{
margin-left: 300px;
margin-right: 300px;
padding-top: 25px;
}
#painthead{
padding: 50px;
}
#contacthead{
margin: 50px;
}
#nature{
margin-left: 300px;
margin-right: 300px;
padding-top: 25px;
}
.paint{
height: 1700px;
background: black;
color: white;
line-height: 40px;
}
#paintpic{
padding-left: 250px;
padding-right:250px;
padding-bottom:50px;
}
#portpic{
padding-left: 250px;
padding-right:250px;
padding-bottom:50px;
padding-top: 50px;
}
#natpic{
padding-left: 250px;
padding-right:250px;
padding-bottom:50px;
padding-top:50px;
}
.portraits{
background: #000000;
color: white;
height: 1400px;
letter-spacing: .25px;
line-height: 40px;
}
#painting{
margin-right: 300px;
margin-left: 300px;
padding-bottom: 75px;
letter-spacing: .25px;
}
iframe{
margin-top: 50px;
margin-bottom: 60px;
border:thick solid #FF0086;
border-width: 30px;
}
.nav{
list-style: none;
position: absolute;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
}
.black ul li{
white-space: nowrap;
display:inline;
color:#aaa;
float:left;
}
.black ul li a{
padding:0px 10px;
color:#f0f0f0;
white-space: nowrap;
}
.black ul li a:hover{
text-decoration: none;
color: #80F9FF;
font-style: normal;
font-weight: 400;
font-family: aguafina-script;
white-space: nowrap;
}
.about ul li{
display: inline;
color:#aaa;
padding:2px;
}
.about ul li a{
color:#000000;
}
.about ul li a:hover{
text-decoration: none;
font-style: normal;
font-weight: 400;
font-family: aguafina-script;
color:#FF8A91;
}
#portraithead{
padding: 50px;
}
.nature ul li{
float:left;
padding:2px;
margin:5px;
color:#aaa;
}
.nature ul li a{
display:block;
color:#222;
}
.nature ul li a:hover{
text-decoration:none;
color:#000;
}
.portraits ul li{
padding: 5px;
margin:5px;
display:inline;
color:#aaa;
float:left;
}
.paint ul li a{
color:#f0f0f0;
}
.paint ul li a:hover{
text-decoration: none;
color: #80F9FF;
font-style: normal;
font-weight: 400;
font-family: aguafina-script;
}
.paint ul li{
padding: 5px;
margin:5px;
display:inline;
color:#aaa;
float:left;
}
.portraits ul li a{
color:#f0f0f0;
}
.portraits ul li a:hover{
text-decoration: none;
color: #80F9FF;
font-style: normal;
font-weight: 400;
font-family: aguafina-script;
}
.contact ul li{
padding: 5px;
margin:5px;
display: inline;
color:#aaa;
float:left;
margin-top: 80px;
}
.contact ul li a{
color:#000000;
}
.contact ul li a:hover{
text-decoration: none;
font-style: normal;
font-weight: 400;
font-family: aguafina-script;
color:#FF8A91;
}
.mouse{
margin-top: 10%;
margin-bottom:20%;
margin-left:50%;
width: 100px;
}
.mouse-icon{
width: 25px;
height: 45px;
border: 2px solid white;
border-radius: 15px;
cursor: pointer;
position: relative;
text-align: center;
}
.mouse-wheel{
height: 6px;
margin: 2px auto 0;
display: block;
width: 3px;
background-color: white;
border-radius: 50%;
-webkit-animation: 1.6s ease infinite wheel-up-down;
-moz-animation: 1.6s ease infinite wheel-up-down;
animation: 1.6s ease infinite wheel-up-down;
}
#blackmouse{
background-color:#000000;
}
#-webkit-keyframes wheel-up-down {
0%
{
margin-top: 2px;
opacity: 0;
}
30% {
opacity: 1;
}
100% {
margin-top: 20px;
opacity: 0;
}
}
#-moz-keyframes wheel-up-down {
0% {
margin-top: 2px;
opacity: 0;
}
30% {
opacity: 1;
}
100% {
margin-top: 20px;
opacity: 0;
}
}#keyframes wheel-up-down {
0% {
margin-top: 2px;
opacity: 0;
}
30% {
opacity: 1;
}
100% {
margin-top: 20px;
opacity: 0;
}
}
footer{
background-color:black;
text-align:center;
color: white;
padding: 30px;
height: 200px;
font-size:20px;
}
#bottom{
width: 100px;
height: 100px;
float: right;
}
#bottom2{
width: 100px;
height: 100px;
float: left;
}
#parawork{
margin-top: 50px;
}
#last{
padding-top: 50px;
padding-bottom: 50px;
}
I posted the part about your responsive video yesterday. Maybe you didn't see the code, I'll look after I see my kids for a while at the rest of what you have there
/* Flexible iFrame */
.flexible-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.flexible-container iframe,
.flexible-container object,
.flexible-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
<!-- Responsive iFrame -->
<div class="flexible-container">
<iframe src="https://b922bde52f23a8481830-83cb7d8d544f653b52d1a1621f05ea9d.ssl.cf3.rackcdn.com/video/landingpage.mp4" frameborder="0" style="border:0"></iframe>
</div>
I created a small website using two flex containers and the result is good. Is it possible to achieve the same result by using only one flexbox container on the container class?
I have been trying to do it but it does not work and I don't want to have two flexbox containers at the same time.
/* Framework.css */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
ul {
padding: 0;
margin: 0;
list-style: none;
}
body {
font-family: 'Electrolize', sans-serif;
}
.container {
max-width: 940px;
margin: 0 auto;
padding: 0 5%;
}
.gallery {
display: flex;
}
.gallery li {
width: 200px;
background-color: #1c1c1c;
color: #bdc3c7;
margin: 0% 0.5% 0% 0.5%;
}
.gallery img {
width: 100%;
height: auto;
}
.gallery p {
margin: 0;
padding: 6%;
font-size: 1.25em;
background-color: #483636;
color: #bdc3c7;
text-align: center;
}
.galleryproducts {
display: flex;
}
.galleryproducts li {
width: 200px;
margin: 2%;
}
.galleryproducts img {
width: 100%;
height: auto;
border: 3px solid white;
}
.latest {
margin-top: 1%;
background-color: #1c1c1c;
}
.latest h1 {
color: white;
font-size: 1.5em;
font-weight: 300;
border-bottom: 3px solid white;
margin-bottom: 5%;
padding: 2%;
}
a {
text-decoration: none;
}
<!-- index.html -->
<div class="container">
<section class="boxes">
<ul class="gallery">
<li>
<a href="img/electrical.png">
<img src="img/electrical.png" alt="">
<p>Electrical Installations</p>
</a>
</li>
<li>
<a href="img/lighting.png">
<img src="img/lighting.png" alt="">
<p>Lighting Decorations</p>
</a>
</li>
<li>
<a href="img/homeappliances1.png">
<img src="img/homeappliances1.png" alt="">
<p>Electrical Appliances</p>
</a>
</li>
<li>
<a href="img/homeappliances2.png">
<img src="img/homeappliances2.png" alt="">
<p>Kitchen Appliances</p>
</a>
</li>
</ul>
</section>
<section class="latest">
<h1>Our latest products</h1>
<ul class="galleryproducts">
<li>
<a href="img/1.jpg">
<img src="img/1.jpg" alt="">
</a>
</li>
<li>
<a href="img/2.jpg">
<img src="img/2.jpg" alt="">
</a>
</li>
<li>
<a href="img/3.jpg">
<img src="img/3.jpg" alt="">
</a>
</li>
<li>
<a href="img/4.jpg">
<img src="img/4.jpg" alt="">
</a>
</li>
</ul>
</section>
</div>
No, you can't set display: flex on the containter an have the gallery's/galleryproducts's children behave as they do now, as they aren't direct children of the container.
If you would change it like that, the boxes/latest will become flex children and the gallery's/galleryproducts's children will just become normal li items, stacked on top of each other, not side by side.
So what you have is what you need, to get the result you say is good (if to assume you want to use flex of course).
I'm new at html and css and i would appreciate if someone would give me a hand with this on. Thank you for all you anwsers in advance.
A strange thing happened when because i added the background and i can't figure out why my hover and active are disabled.
HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Project1</title>
<link href="cssprojectgallery.css" rel="stylesheet" type="text/css">
<div class="logo" >
<img src="../MT portfolio/lg.png" alt="" width="180" height="178" class="logo"/>
</div>
</head>
<body>
<nav>
<li><a< href".html">Home</li></a>
<li><a< href"projects.html">Projects</li></a>
<li><a< href"about.html">About</li></a>
<li><a< href"contact.html">Contact</li></a>
</nav>
<div class="gal">
<img src="LOGOS/Ampire.jpg" width="800" alt=""/>
<img src="LOGOS/Pacakama.jpg" alt="" width="800"/>
<img src="LOGOS/Zoom.jpg" alt="" width="800"/>
<img src="LOGOS/Futura.jpg" alt=""width="800""/>
<img src="LOGOS/Soundgrounded.jpg" alt=""width="800""/>
<img src="LOGOS/Gams.jpg" alt=""width="800""/>
<img src="LOGOS/Bullseye.jpg" alt=""width="800""/>
<img src="LOGOS/Union.jpg" alt=""width="800""/>
<img src="LOGOS/Skylinq.jpg" alt=""width="800""/>
</div>
</body>
</html>
CSS
#charset "utf-8";
.logo {
padding-bottom: 30px;
text-align: center;
}
nav {
font-family: "Proxima Nova ScOsf ExCn Rg";
text-align: center;
font-size: 35px;
word-spacing: 80px;
padding-right: 50px;
padding-bottom: 2%;
padding-left: 50px;
color: #000000; }
li {
display: inline;
color: #000000;
}
a {
text-decoration: none;
color: black;
}
a:hover {
color: lightgray;
}
a:active {
color: black;
}
body {
background-image: url(../mt/back.jpg);
background-sizce: cover;
}
.gal {
text-align: center;
background-color: #000000;
background-size: 0% auto;
margin-top: 0.5%;
padding-top: 2%;
padding-bottom: 0.5%;
border-top-left-radius: 0px;
margin-right: 20%;
margin-left: 20%;
margin-bottom: 5%;
}
.gal img {
vertical-align: middle;
padding-top: 1%;
padding-bottom: 2%;
}
Your markup is not valid that is why hover and active states are not responding. Please correct your HTML code as follows.
<nav>
<ul>
<li>
Home
</li>
<li>
Projects
</li>
<li>
About
</li>
<li>
Contact
</li>
</ul>
</nav>
I have created a webpage,which look like this
I have to display a image gallery in the yellow mark which I have made. I haved tried everything but it comes below the footer. Can I get some idea how can I achieve this?
here is my code
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="index_style.css">
</head>
<body>
<div class="nav">
<div class="container">
<ul class="pull-left">
<li>Home</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
<ul class="pull-right">
<li>Welcome to our Store</li>
<li>Login</li>
<li>or</li>
<li>Register</li>
<li>yourself!</li>
</ul>
<div class="clear"></div>
</div>
</div>
<div class="extra0">
<div class="cata-head">
Choose a category!
</div>
<ul class="cata">
<li>Men's Clothing</li>
<li>Men's Accesories</li>
<li>Women's Clothing</li>
<li>Women's Accesories</li>
<li>Baby Products</li>
</ul>
</div>
<div class="extra">
<img src="extra.png">
<img src="extra1.png">
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="klematis2_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm"><img src="klematis3_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="klematis4_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="foot">
<footer>
Policies: Terms of use | Security | Privacy | Infringement <b> UsamaRehan & AsjadHussaini©</style> </b>
<img src="face.png">
<img src="tweet.png">
<img src="you.png">
</footer>
</div>
</body>
</html>
******CSS
body {
//overflow: hidden;
background-color: #d0e4fe;
//background-image: url("background.jpg");
font-family: "Book Antiqua",Times New Roman, Georgia, Serif;
}
.nav
{
border-style: solid;
}
.nav a {
color: #5a5a5a;
font-size: 15px;
font-weight: bold;
padding: 14px 10px;
text-transform: uppercase;
}
.nav li {
display: inline;
}
a:hover {
color: coral;
}
.pull-left
{
float:left
}
.pull-right
{
float:right
}
.clear
{
clear:both;
}
.container
{
padding-right: 75px;
margin-right: auto;
margin-left: auto;
background-color:#bbb;
}
.extra0{
background-color: #555;
width: 250px;
padding-bottom: 10px;
margin-top: 5px;
border-style: solid;
border-color: #0ca3d2;
}
.cata-head
{
font-size: 18px;
font-weight: bold;
padding: 10px 0px 5px 15px;
text-transform: uppercase;
color: activeborder;
border-style: solid;
border-bottom-color: #0ca3d2;
border-left-color:#555;
border-right-color: #555;
border-top-color: #555;
}
.cata
{
color: #b3c0c8;
list-style-image: url("list.png");
line-height: 2.333em;
}
.foot
{
background:#ffab62;
width:100%;
height:30px;
position:absolute;
bottom:0;
left:0;
padding-left: 15px;
padding-bottom: 5px;
}
b
{
color: firebrick;
}
.extra
{
width: 250px;
padding-top: 12px;
padding-left: 12px;
}
.main
{
border-style: solid;
border-color: black;
display: block;
width: 250px;
margin: 10px 10px;
}
div.img {
/* margin: 5px;
padding: 5px;
border: 1px solid #0000ff;
height: auto;
width: auto;
float: left;
text-align: center;*/
margin: 10px 10px;
width: auto;
border:3px solid #73AD21;
padding: 10px;
float: left;
}
div.img img {
display: inline;
margin: 5px;
border: 1px solid #ffffff;
}
div.img a:hover img {
border:1px solid #0000ff;
}
div.desc {
text-align: center;
font-weight: normal;
width: 120px;
margin: 5px;
}
I have added some extra div to float the element. here is the link below http://codepen.io/anon/pen/yYwVLM
HTML
<div class="nav">
<div class="container">
<ul class="pull-left">
<li>Home</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
<ul class="pull-right">
<li>Welcome to our Store</li>
<li>Login</li>
<li>or</li>
<li>Register</li>
<li>yourself!</li>
</ul>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
<div class="pull-left">
<div class="extra0">
<div class="cata-head">
Choose a category!
</div>
<ul class="cata">
<li>Men's Clothing</li>
<li>Men's Accesories</li>
<li>Women's Clothing</li>
<li>Women's Accesories</li>
<li>Baby Products</li>
</ul>
</div>
<div class="extra">
<img src="extra.png">
<img src="extra1.png">
</div>
</div>
<div class="pull-left">
ADD GALLERY HERE <br>
<img src="http://placehold.it/500x200">
<img src="http://placehold.it/500x200">
<img src="http://placehold.it/500x200">
</div>
<div class="clear"></div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="klematis2_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm"><img src="klematis3_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="klematis4_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="clear"></div>
<div class="foot">
<footer>
Policies: Terms of use | Security | Privacy | Infringement <b> UsamaRehan & AsjadHussaini©</style> </b>
<img src="face.png">
<img src="tweet.png">
<img src="you.png">
</footer>
</div>
CSS
body {
overflow: hidden;
background-color: #d0e4fe;
background-image: url("background.jpg");
font-family: "Book Antiqua",Times New Roman, Georgia, Serif;
}
.nav
{
border-style: solid;
}
.nav a {
color: #5a5a5a;
font-size: 15px;
font-weight: bold;
padding: 14px 10px;
text-transform: uppercase;
}
.nav li {
display: inline;
}
a:hover {
color: coral;
}
.pull-left
{
float:left;
}
.pull-right
{
float:right;
}
.clear
{
clear:both;
}
.container
{
padding-right: 75px;
margin-right: auto;
margin-left: auto;
background-color:#bbb;
}
.extra0{
background-color: #555;
width: 250px;
padding-bottom: 10px;
margin-top: 5px;
border-style: solid;
border-color: #0ca3d2;
}
.cata-head
{
font-size: 18px;
font-weight: bold;
padding: 10px 0px 5px 15px;
text-transform: uppercase;
color: activeborder;
border-style: solid;
border-bottom-color: #0ca3d2;
border-left-color:#555;
border-right-color: #555;
border-top-color: #555;
}
.cata
{
color: #b3c0c8;
list-style-image: url("list.png");
line-height: 2.333em;
}
.foot
{
background:#ffab62;
width:100%;
height:30px;
position:absolute;
bottom:0;
left:0;
padding-left: 15px;
padding-bottom: 5px;
}
b
{
color: firebrick;
}
.extra
{
width: 250px;
padding-top: 12px;
padding-left: 12px;
}
.main
{
border-style: solid;
border-color: black;
display: block;
width: 250px;
margin: 10px 10px;
}
div.img {
/* margin: 5px;
padding: 5px;
border: 1px solid #0000ff;
height: auto;
width: auto;
float: left;
text-align: center;*/
margin: 10px 10px;
width: auto;
border:3px solid #73AD21;
padding: 10px;
float: left;
}
div.img img {
display: inline;
margin: 5px;
border: 1px solid #ffffff;
}
div.img a:hover img {
border:1px solid #0000ff;
}
div.desc {
text-align: center;
font-weight: normal;
width: 120px;
margin: 5px;
}
i changed you html structure i.e
Created one div with class gallery and put all images inside that div
in your html your images doesn't have any parent. if you use parent then it will help to move all chilled according to parent.
Note : see result in full screen
<div class="container">
<div class="extra0">
</div>
<div class="gallery">
<!---all imaged-->
</div>
</div>
body {
//overflow: hidden;
background-color: #d0e4fe;
//background-image: url("background.jpg");
font- amily: "Book Antiqua", Times New Roman, Georgia, Serif;
}
.nav {
border - style: solid;
}
.nav a {
color: #5a5a5a;
font-size: 15px;
font-weight: bold;
padding: 14px 10px;
text-transform: uppercase;
}
.nav li {
display: inline;
}
a:hover {
color: coral;
}
.pull-left {
float: left
}
.pull-right {
float: right
}
.clear {
clear: both;
}
.container {
padding-right: 75px;
margin-right: auto;
margin-left: auto;
background-color: # bbb;
width: 100 %;
display: inline-block;
}
.extra0 {
background-color: #555;
width: 20%;
display: inline-block;
padding-bottom: 10px;
margin-top: 5px;
border-style: solid;
border-color: #0ca3d2;
}
.cata - head {
font-size: 18 px;
font-weight: bold;
padding: 10px 0px 5px 15px;
text-transform: uppercase;
color: activeborder;
border-style: solid;
border-bottom-color: #0ca3d2;
border-left-color: #555;
border-right-color: #555;
border-top-color: #555;
}
.cata {
color: #b3c0c8;
list-style - image: url("list.png");
line-height: 2.333em;
}
.foot {
background: #ffab62;
width: 100%;
height: 30px;
position: fixed;
bottom: 0;
left: 0;
padding-left: 15px;
padding-bottom: 5px;
}
b {
color: firebrick;
}
.extra {
width: 250px;
padding-top: 12px;
padding-left: 12px;
}
.main {
border-style: solid;
border-color: black;
display: block;
width: 250px;
margin: 10px 10px;
}
div.img {
/* margin: 5px;
padding: 5px;
border: 1px solid #0000ff;
height: auto;
width: auto;
float: left;
text-align: center;*/
margin: 10px 10px;
width: auto;
border: 3 px solid #73AD21;
padding: 10px;
float: left;
}
div.img img {
display: inline;
margin: 5px;
border: 1px solid #ffffff;
}
div.img a: hover img {
border: 1 px solid #0000ff;
}
div.desc {
text-align: center;
font-weight: normal;
width: 120px;
margin: 5px;
}
.gallery {
width: 75%;
display: inline-block;
}
<div class="nav">
<div class="container">
<ul class="pull-left">
<li>Home</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
<ul class="pull-right">
<li>Welcome to our Store</li>
<li>Login</li>
<li>or</li>
<li>Register</li>
<li>yourself!</li>
</ul>
<div class="clear"></div>
</div>
</div>
<div class="container">
<div class="extra0">
<div class="cata-head">
Choose a category!
</div>
<ul class="cata">
<li>Men's Clothing</li>
<li>Men's Accesories</li>
<li>Women's Clothing</li>
<li>Women's Accesories</li>
<li>Baby Products</li>
</ul>
</div>
<div class="gallery">
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="klematis2_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm"><img src="klematis3_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="klematis4_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
</div>
<div class="extra">
<img src="extra.png">
<img src="extra1.png">
</div>
<div class="foot">
<footer>
Policies: Terms of use | Security | Privacy | Infringement <b> UsamaRehan & AsjadHussaini©</style> </b>
<img src="face.png">
<img src="tweet.png">
<img src="you.png">
</footer>
</div>
I have add some new div and css here is link check : http://codepen.io/anon/pen/BobQzo
body {
//overflow: hidden;
background-color: #d0e4fe;
//background-image: url("background.jpg");
font-family: "Book Antiqua",Times New Roman, Georgia, Serif;
}
.nav
{
border-style: solid;
}
.nav a {
color: #5a5a5a;
font-size: 15px;
font-weight: bold;
padding: 14px 10px;
text-transform: uppercase;
}
.nav li {
display: inline;
}
a:hover {
color: coral;
}
.pull-left
{
float:left
}
.sidebar {
float: left;
width: 250px;
}
.pull-right
{
float:right
}
.clear
{
clear:both;
}
.container
{
padding-right: 75px;
margin-right: auto;
margin-left: auto;
background-color:#bbb;
}
.gallery {
float: left;
width:80%;
margin-bottom: 40px;
}
.extra0{
background-color: #555;
width: 250px;
padding-bottom: 10px;
margin-top: 5px;
border-style: solid;
border-color: #0ca3d2;
}
.cata-head
{
font-size: 18px;
font-weight: bold;
padding: 10px 0px 5px 15px;
text-transform: uppercase;
color: activeborder;
border-style: solid;
border-bottom-color: #0ca3d2;
border-left-color:#555;
border-right-color: #555;
border-top-color: #555;
}
.cata
{
color: #b3c0c8;
list-style-image: url("list.png");
line-height: 2.333em;
}
.foot
{
background:#ffab62;
width:100%;
height:30px;
position:fixed;
bottom:0;
left:0;
float: left;
padding-left: 15px;
padding-bottom: 5px;
}
b
{
color: firebrick;
}
.extra
{
width: 250px;
padding-top: 12px;
padding-left: 12px;
}
.main
{
border-style: solid;
border-color: black;
display: block;
width: 250px;
margin: 10px 10px;
}
div.img {
/* margin: 5px;
padding: 5px;
border: 1px solid #0000ff;
height: auto;
width: auto;
float: left;
text-align: center;*/
margin: 10px 10px;
width: auto;
border:3px solid #73AD21;
padding: 10px;
float: left;
}
div.img img {
display: inline;
margin: 5px;
border: 1px solid #ffffff;
}
div.img a:hover img {
border:1px solid #0000ff;
}
div.desc {
text-align: center;
font-weight: normal;
width: 120px;
margin: 5px;
}
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="index_style.css">
</head>
<body>
<div class="nav">
<div class="container">
<ul class="pull-left">
<li>Home</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
<ul class="pull-right">
<li>Welcome to our Store</li>
<li>Login</li>
<li>or</li>
<li>Register</li>
<li>yourself!</li>
</ul>
<div class="clear"></div>
</div>
</div>
<div class="sidebar">
<div class="extra0">
<div class="cata-head">
Choose a category!
</div>
<ul class="cata">
<li>Men's Clothing</li>
<li>Men's Accesories</li>
<li>Women's Clothing</li>
<li>Women's Accesories</li>
<li>Baby Products</li>
</ul>
</div>
<div class="extra">
<img src="extra.png">
<img src="extra1.png">
</div>
</div>
<div class="gallery">
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis_big.htm"><img src="p1.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="klematis2_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm"><img src="klematis3_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="klematis4_small.jpg" alt="Klematis" width="110" height="90"></a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
<div class="foot">
<footer>
Policies: Terms of use | Security | Privacy | Infringement <b> UsamaRehan & AsjadHussaini©</style> </b>
<img src="face.png">
<img src="tweet.png">
<img src="you.png">
</footer>
</div>
</body>
</html>
there is two div one sidebar and gallery
I think you can use position absolute and give the top & left for your div.
.img{
position: absolute;
top: 30px;
left: 30px;
}
I have a content with Title, image and description. I have 3 differents contents, which i have to put side by side. What would be better do achive this ? I did with <ul>. But the image wasnts below title, and description below image, so i just but after <li></li> a break, and it worked. But in IE it doesnt.
Here is what i got - > http://jsfiddle.net/5xfR9/12/
<div id="content">
<ul>
<li>
<h3>Custom clearance</h3><br/>
<img src="..." style="width:360px; height: 160px;" alt="Custom clearance" /><br/>
<p style="width:360px;">...<br />Learn more <img src="images/arrow.png" alt="learn more" style="width:6px; height:9px; border: 0px;"/><br/>
</p>
</li>
<li>
<h3>Cargo Inspections</h3><br/>
<img src="..." style="width:360px; height: 160px;" alt="Custom clearance" /><br/>
<p style="width:360px; padding">...<br />Learn more <img src="images/arrow.png" alt="learn more" style="width:6px; height:9px; border: 0px;"/>
</p><br/>
</li>
<li>
<h3>Our Location</h3><br/>
<img src="..." style="width:360px; height: 160px;" alt="Custom clearance" /><br/>
<p style="width:360px;">....<br />Learn more <img src="images/arrow.png" alt="learn more" style="width:6px; height:9px; border: 0px;"/>
</p><br/>
</li>
</ul>
</div>
using this CSS
#content {
width: 100%;
min-height: 450px;
display: block;
padding-bottom:40px;
}
#content ul li {
display: inline;
list-style: none;
float: left;
min-width:32%;
}
#content ul li > h3 {
text-decoration: none;
display:block;
float:left;
font-size: 24px;
margin: 0 0 0 20px;
font-family: gothamlight;
padding: 10px 20px 10px 20px;
}
#content ul li > img {
display: block;
float:left;
margin: 0 0 0 10px;
padding: 0px 25px 0px 25px;
}
#content ul li > p {
text-decoration: none;
line-height: 1.3;
display:block;
color: #404041;
float:left;
font-size: 14px;
margin: 0 0 0 20px;
padding: 5px 20px 5px 20px;
display: block;
}
I guess I did it wrong, I put <br /> after a <li></li>, so that content would be vertical.
But of course IE is smart and it shows Content 1 for the whole width page, and other content is after the first one.