I am a novice to learning HTML and CSS. I want to add images at the top of footer. How can I achieve it.
I have the footer created and the images in one line. But somehow i don't know how to place them at top of the footer. The HTML and CSS are below. Using stylesheet from bootstrap.
<id ="image">
<img src="images1.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;" />
<img src="images2.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
<img src="images3.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
<img src="images4.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
<img src="images5.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
</id>
<footer id="footer">
<div class="container">
<p>some text for the footer</p>
</div>
</footer>
The CSS used is below.
#footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
text-align:center;
background-color: #f5f5f5;
}
#image {
position: relative;
bottom: 0;
width: 100%;
}
Try something like this:
http://codepen.io/anon/pen/bVeQyb
<div id="images">
<img src="http://placehold.it/80x80.png">
<img src="http://placehold.it/80x80.png">
<img src="http://placehold.it/80x80.png">
<img src="http://placehold.it/80x80.png">
<img src="http://placehold.it/80x80.png">
</div>
#footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
text-align:center;
background-color: #f5f5f5;
}
#images {
text-align: center;
position: absolute;
bottom: 80px;
width: 100%;
}
#images a{
display: inline-block;
margin: 0 10px;
}
One method would be to position your images absolute as well. Code below:
<div id="image">
<img src="images1.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;"/>
<img src="images2.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
<img src="images3.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
<img src="images4.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
<img src="images5.png" align="left" style="width:20%;height:200px;margin:auto;padding:75px;">
</div>
<footer id="footer">
<div class="container">
<p>some text for the footer</p>
</div>
</footer>
#image {
position: absolute;
bottom: 60px;
width: 100%;
}
2nd method: Place your images inside the footer, in this case you need to change the footer height, since it is absolute positioned.
3rd method: Simply leave the footer in the content flow. Remove the absolute positioning.
Related
My Problem
I want to make text-box/a box over an image with div, i already tried this but why it can't.
My code goes here:
HTML/CSS :
.main{
position: relative;
margin: 8;
}
.main img{
position: relative;
height: 510px;
width: 100%;
}
.main-content{
position: absolute;
background: white;
height: 40px;
width: 40px;
}
<!DOCTYPE html>
<html>
<head>
<title>PokeMart</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<img src="valor.png">
<h3>PokeMart</h3>
<h4>Login</h4>
<h4>Register</h4>
</div>
<div class="main">
<img src="bg.jpg" />
<div class="main-content">Text</div>
</div>
<div class="footer">
<h5>Pokemart established 2017, powered by Pokemon Company</h5>
<h5>Copyright © 2017 LL. All Right Reserved.</h5>
<div class="contact">
<img src="facebook.png" width="25" height="25">
<img src="google.png" width="25" height="25">
<img src="twitter.png" width="25" height="25">
<img src="github.png" width="25" height="25">
<img src="instagram.png" width="25" height="25">
</div>
</div>
</body>
</html>`
CSS code just the floating div, I have tried Display: Inline-block still don't work.
You're using absolute positioning but not directing where the content should be placed. Try using top,left,right,bottom to adjust the content position.
top:20%;
right:100px;
.main {
position: relative;
margin: 8;
}
.main img {
position: relative;
height: 510px;
width: 100%;
}
.main-content {
position: absolute;
top: 20%;
right: 100px;
background: white;
height: 40px;
width: 40px;
}
<!DOCTYPE html>
<html>
<head>
<title>PokeMart</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<img src="valor.png">
<h3>PokeMart</h3>
<h4>Login</h4>
<h4>Register</h4>
</div>
<div class="main">
<img src="http://via.placeholder.com/9000x500" />
<div class="main-content">Text</div>
</div>
<div class="footer">
<h5>Pokemart established 2017, powered by Pokemon Company</h5>
<h5>Copyright © 2017 LL. All Right Reserved.</h5>
<div class="contact">
<img src="facebook.png" width="25" height="25">
<img src="google.png" width="25" height="25">
<img src="twitter.png" width="25" height="25">
<img src="github.png" width="25" height="25">
<img src="instagram.png" width="25" height="25">
</div>
</div>
</body>
</html>`
.wrap {
border: 1px solid #000;
position: relative;
max-width: 450px;
}
.wrap img {
border: 1px solid #000;
display: block;
width: 100%;
box-sizing: border-box;
}
.wrap .overlay {
border: 1px solid #000;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
}
.wrap .overlay .box {
margin: auto;
background-color: #FFF;
border: 1px solid #000;
padding: 40px;
}
<div class="wrap">
<img src="http://www.telegraph.co.uk/content/dam/gaming/2017/10/10/Pokemon-Halloween_trans_NvBQzQNjv4BqZPnXlBHEdt8AtjizIYNgmRSlK0RKxqt6w8JJghUtSuI.jpg?imwidth=450">
<div class="overlay">
<div class="box">box</div>
</div>
</div>
(source: kheper.net)
The effect I'm going for is the whole square being one div, with each square being a smaller div within the bigger div, correctly aligned, to take up the entire viewport.
Similar to montere.it minus the JavaScript.
I've tried to highlight the problematic bits of code, the corresponding CSS isn't formatting correctly but I've linked a JS bin below.
Apologies if my code is spaghetti code, it's less my code and more a copy and paste session gone wild.
#bodyHobbies {
width: 100%;
height: 500px;
}
.intbox1 {
height: 25%;
width: 100%;
background-color: #009900;
margin: auto;
text-align: center;
}
.intbox2 {
height: 25%;
width: 100%;
background-color: #990000;
margin: auto;
text-align: center;
color: #FFFFFF;
}
.intbox3 {
height: 25%;
width: 100%;
background-color: #000000;
margin: auto;
text-align: center;
color: #FFFFFF;
}
.intbox4 {
height: 25%;
width: 100%;
background-color: #990000;
margin: auto;
text-align: center;
color: #FFFFFF;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div id="bodyHobbies">
<div class="intbox1">
<p>1</p>
<img src="foobar1.jpg" border="0" />
</div>
<div class="intbox2">
<p>2</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox3">
<p>3</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox4">
<p>4</p>
<img src="foobar.jpg" border="0" />
</div>
</div>
https://jsbin.com/heyibe/edit?html,css,output
you can done that using css3 flexbox concept
html,body{
margin:0;
padding:0;
width:100%;
height:100%;
}
img{
width:100%;
}
#bodyHobbies{
display:flex;
flex-flow: row wrap;
}
.item{
flex-basis:50%;
}
<div id="bodyHobbies">
<div class="intbox1 item"><p>1</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
<div class="intbox2 item"><p>2</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
<div class="intbox3 item"><p>3</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
<div class="intbox4 item"><p>4</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
</div>
Just added display: inline-table to you #bodyHobbies and added a common class to the intbox divs. Removed the individual intbox stylings related to width and heights.
#bodyHobbies {
width: 100%;
height: 500px;
display: inline-table;
}
.intbox {
width: 50%;
height: 50%;
display: inline-block;
}
.intbox img {
width: 100%;
}
.intbox1 {
background-color:#009900;
margin:auto;
text-align:center;
}
.intbox2 {
background-color:#990000;
margin:auto;
text-align:center;
color:#FFFFFF;
}
.intbox3 {
background-color:#000000;
margin:auto;
text-align:center;
color:#FFFFFF;
}
.intbox4 {
background-color:#933230;
margin:auto;
text-align:center;
color:#FFFFFF;
}
<div id="bodyHobbies">
<div class="intbox intbox1"><p>1</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
<div class="intbox intbox2"><p>2</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
<div class="intbox intbox3"><p>3</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
<div class="intbox intbox4"><p>4</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
</div>
Try this
<div id="bodyHobbies">
<div class="intbox1"><p>1</p>
<img src="foobar1.jpg" border="0" />
</div>
<div class="intbox2"><p>2</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox3"><p>3</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox4"><p>4</p>
<img src="foobar.jpg" border="0" />
</div>
CSS
#bodyHobbies div{
float: left;
width: 50%;
}
<div id="bodyHobbies">
<div class="box">
<p>1</p>
<img src="foobar1.jpg" border="0" />
</div>
<div class="box">
<p>2</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="box">
<p>3</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="box">
<p>4</p>
<img src="foobar.jpg" border="0" />
</div>
</div>
<style>
.box{width:calc(50% - 2px); margin:2px; float:left; min-height:100px;}
</style>
At css use vw, vh units to set body, parent element width, height to 100vw, 100vh. Set [class=^"int"] selector position to absolute. Set element left and top properties corresponding to the four positions within the viewport using :nth-of-type() pseudo class. left:0vw, top:0vh; left:50vw, top:0vh; left:0vw, top:50vh, left:50vw, top:50vh.
body {
width: 100vw;
height: 100vh;
}
#bodyHobbies {
width: 100vw;
height: 100vh;
display: block;
position: relative;
border: 2px solid sienna;
}
[class^="int"] {
width: 50vw;
height: 50vh;
display: block;
position: absolute;
border: 2px solid gold;
}
[class^="int"]:nth-of-type(1) {
left: 0vw;
top: 0vw;
background: blue;
}
[class^="int"]:nth-of-type(2) {
left: 50vw;
top: 0vh;
background: green
}
[class^="int"]:nth-of-type(3) {
left: 0vw;
top: 50vh;
background: red;
}
[class^="int"]:nth-of-type(4) {
left: 50vw;
top: 50vh;
background: tan;
}
<div id="bodyHobbies">
<div class="intbox1">
<p>1</p>
<img src="foobar1.jpg" border="0" alt="foobar1" />
</div>
<div class="intbox2">
<p>2</p>
<img src="foobar.jpg" border="0" alt="foobar2" />
</div>
<div class="intbox3">
<p>3</p>
<img src="foobar.jpg" border="0" alt="foobar3" />
</div>
<div class="intbox4">
<p>4</p>
<img src="foobar.jpg" border="0" alt="foobar4" />
</div>
</div>
jsfiddle https://jsfiddle.net/69zkbjgw/
How do I make all my anchor links / images go to specific sides I want the teams one on top left I want store top right sponsors bottom left and about us bottom right I thought I did all the right code but they don't how up in those specific spots
If anyone can help it will be greatly appreciates
CSS
.icon1.jpg {
position: absolute;
top: 0px;
left: 0px;
height: auto;
width: 50%;
}
.icon2.jpg {
position: relative;
top: 0px;
right: 0px;
height: auto;
width: 50%;
}
.icon4.jpg {
position: relative;
left: 0px;
height: auto;
width: 50%;
}
.icon3.jpg {
position: relative;
right: 0px;
height: auto;
width: 50%;
}
.DelUZens {
display: block;
margin-left: auto;
margin-right: auto;
}
body {
background: url("icon6.jpg") repeat;
}
#banner {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
width: 100%;
height: 175px;
z-index: -1;
}
<html>
<head>
<title>DelUZens</title>
<link href="main.css" rel="stlesheet" type="text/css">
</head>
<body bgcolor="#000">
<div z-index:1;>
<p>
<a href="teams.html" target="_blank">
<img src="icon1.jpg" style='width:50%;' border="0" alt="Null" class="top" z-index:2>
</a>
</p>
<p>
<a href="store.html" target="_blank">
<img src="icon2.jpg" style='width:50%;' border="0" alt="Null" class="right" z-index:3>
</a>
</p>
<p>
<a href="sponsors.html" target="_blank">
<img src="icon4.jpg" style='width:50%;' border="0" alt="Null" class="left" z-index:4>
</a>
</p>
<p>
<a href="aboutus.html" target="_blank">
<img src="icon3.jpg" style='width:50%;' border="0" alt="Null" class="bottom" z-index:5>
</a>
</p>
</div>
<div id="myDiv" style="position:absolute; top:230px; left:591px; right: 591px; bottom: 230px; width:0px; height:0px; z-index:8;">
<img src="icon5.png" class="DelUZens">
</div>
</body>
</html>
Thank you in advance.
if (myDiv) in a nother page use this
<a href="teams.html#myDiv" target="_blank">
<img src="icon1.jpg" style='width:50%;' border="0" alt="Null" class="top" z-index:2>
</a>
if (myDiv) in the same page use this
<a href="#myDiv" target="_blank">
<img src="icon1.jpg" style='width:50%;' border="0" alt="Null" class="top" z- index:2>
</a>
I want the footer to stay at the bottom of the page. Right now, it's at the top... I've posted my html and all my css so you can see. I figured it might be easier to do it that way? I've tried to add containers that stretch the body to the bottom, but it messes with my other containers on the page and makes them fall off way into the top. I need a quick answer because this is due in a week!
* {
margin:0;
padding:0;
}
body {
font-family:Arial;
background:#fff url(images/bg1.png) repeat;
background-size: 700px;
height: 100%;
min-height: 100%;
}
.title {
width:548px;
height:119px;
position:absolute;
background:transparent url(title.png) no-repeat top left;
}
#content {
margin:0 auto;
}
#horizon {
text-align: center;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
overflow: visible;
visibility: visible;
display: block;
}
#stuff {
font-family: Verdana, Geneva, Arial, sans-serif;
background-color: #fff;
opacity: 0.6;
margin-left: -500px;
position: absolute;
top: -125px;
left: 50%;
width: 1000px;
height: 250px;
visibility: visible;
overflow: scroll;
padding: 10px;
border: 5px dotted #F3DECD;
text-align: center;
}
footer {
}
<body>
<div id="content">
<div class="title"></div>
<div class="navigation" id="nav">
<div class="item user">
<img src="images/bg_user.png" alt="" width="199" height="199" class="circle"/>
<h2>Home</h2>
<ul>
<li>About the Shop</li>
<li>About the Artist</li>
</ul>
</div>
<div class="item home">
<img src="images/bg_home.png" alt="" width="199" height="199" class="circle"/>
<h2>How-To's</h2>
<ul>
<li>Jewelry</li>
<li>Clay</li>
</ul>
</div>
<div class="item shop">
<img src="images/bg_shop.png" alt="" width="199" height="199" class="circle"/>
<h2>Portfolio</h2>
<ul>
<li>Jewelry</li>
<li>Clay</li>
<li>Digital</li>
</ul>
</div>
<div class="item camera">
<img src="images/bg_camera.png" alt="" width="199" height="199" class="circle"/>
<h2>Contact</h2>
<ul>
<li>Questions</li>
<li>Suggestions</li>
</ul>
</div>
</div>
</div>
<div id="horizon">
<div id="stuff">
<h2> Welcome! </h2><br>
<p>This is a page that I have created for all my jewelry. This will be updated with new information periodically.</p>
</div>
</div>
<footer>
<a href="">
<img height="32" width="32" alt="'s Deviantart" src="deviantart.png">
</a>
<a href="">
<img height="32" width="32" alt="'s Think Jewelry Page" src="facebook.png">
</a>
</footer>
you could simply set a div with a position of absolute. It would look something like this:
html:
<div id='footer'></div>
css:
#footer{
height:45px;
width:100%;
background-color:grey;
position:absolute;
bottom:0;
}
You can use a fixed footer:
HTML
<footer>
...
</footer>
CSS
footer {
position: fixed;
left: 0px;
bottom: 0px;
height: 150px;
width: 100%;
}
The footer will always be visible in the viewport at the bottom of your page, check out this codepen.
If you are looking for a sticky footer approach check this.
For a sticky footer that is always present at the end of main content, I’ve always found using a wrapper containing a negative push div (set as the same size as the required footer) is a simple, yet the most solid approach.
CSS
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
height: auto !important;
height: 100%;
min-height: 100%;
margin: 0 auto -150px;
}
.push {
height: 150px;
}
footer {
height: 150px;
background-color: #900; /*red */
}
HTML
<html>
<head>
<!-- -->
</head>
<body>
<div class="wrapper">
<p>Main Content</p>
<!-- -->
<div class="push"></div>
</div>
<footer>
<p>Footer Content</p>
<!-- -->
</footer>
</body>
</html>
See codepen example here:
http://codepen.io/anon/pen/EaPRQb
Simply change the push div and footer heights to be the desired height (in my example 150px) and the wrapper's bottom margin to be a negative of that height (ie. -150px in my example)
You can try like this,
footer
{
position:fixed;
}
So I just want to say sorry for messy code, I have tried vigorously with this. Basically I want there to be 3 images side by side which I will later make clickable, and a gray background behind them. Then I want to be able to include text below the images. Any help?
HTML
Premium Store
<table id="table1" >
<tr id="imgs">
<div id="tablet">
<table border="0";>
<td><img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Assistant-icon.png"/></td>
<td><img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Delivery-icon.png"/></td>
<td><img src="http://icons.iconarchive.com/icons/visualpharm/<icons8-metro-> </icons8-metro->style/128/Business-Shop-icon.png"/></td>
</div>
</tr>
<td>
Contact a representative!
</td>
<td>
Deliver to your house!
</td>
<td>
Locate a store!
</td>
</table>
CSS
#backgroundH
{
width: 100%;
height: 50px;
background-color: #dddddd;
position: absolute;
}
#header
{
top: -50px;
color: black;
font-family: "Courier New";
text-align: center;
}
body
{
background-color: #cccccc;
}
#table1
{
width: 500px;
height: 200px;
background-color: #d9d9d9;
position: fixed;
margin-left: -250px;
margin-top: -100px;
top:50%;
left:50%;
}
td
{
width: 10px;
height: 450px;
position: relative;
margin-left: -5px;
margin-top: -225px;
top: 35%;
left: 3%;
}
Also please include what I did wrong! I am having a hard time understanding positioning, in-specific how to add a neat setup. (If somebody could skype with me I have some questions.. :P skype-ikorey1)
Thank you all for the help and reading. I really do appreciate all the feedback.
<html lang="en">
<head>
<style type="text/css">
.img-with-text { float: left; text-align: center}
</style>
</head>
<body>
<div class="container">
<div class="img-with-text"><img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Assistant-icon.png" border="0" alt="" width="200" height="230" style="border: 2px solid black;" />
<p>Anup<br />9096969903<br />Email Carl Call </p>
</div>
<div class="img-with-text"><img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Delivery-icon.png" border="0" alt="" width="200" height="230" style="border: 2px solid black;" />
<p>Anup<br />9096969903<br />Email Sjon Gentry</p>
</div>
<div class="img-with-text"><img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Assistant-icon.png" border="0" alt="" width="200" height="230" style="border: 2px solid black;" />
<p>Anup<br />9096969903<br />Email John Mabery </p>
</div>
</div>
<!-- End of your code -->
<p style="clear: both">Something more here </p>
There is a special way of making that type of arrangement (image with caption).
And this would be my way of doing what you need:
HTML
<div id="container">
<figure>
<img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Assistant-icon.png"/>
<figcaption>Fig.1 - A view of the pulpit rock in Norway.</figcaption>
</figure>
<figure>
<img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Delivery-icon.png"/>
<figcaption>Fig.1 - A view of the pulpit rock in Norway.</figcaption>
</figure>
<figure>
<img src="http://icons.iconarchive.com/icons/visualpharm/<icons8-metro-> </icons8-metro->style/128/Business-Shop-icon.png"/>
<figcaption>Fig.1 - A view of the pulpit rock in Norway.</figcaption>
</figure>
</div>
CSS
#container{
background:#ccc;
}
#container figure{
float:left
}
How about this..
<table id="table1">
<tr id="imgs">
<td>
<img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Assistant-icon.png" />
<p class="content">
Contact a representative!
</p>
</td>
<td>
<img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Delivery-icon.png" />
<p class="content">
Deliver to your house!
</p>
</td>
<td>
<img src="http://icons.iconarchive.com/icons/visualpharm/icons8-metro-style/128/Business-Shop-icon.png" />
<p class="content">
Locate a store!
</p>
</td>
</tr>
</table>
and css
body {
background-color: #cccccc;
}
#table1 {
width: 500px;
height: 200px;
background-color: #d9d9d9;
position: fixed;
margin-left: -250px;
margin-top: -100px;
top: 50%;
left: 50%;
}
tr {
width: 10px;
height: 450px;
position: relative;
margin-left: -5px;
margin-top: -225px;
top: 35%;
left: 3%;
}
td.content {
position: absolute;
}
and for position details are explained clearly in w3schools
which will helps us alot.