How to move second image to center of div [responsive design] ?
https://jsfiddle.net/ydufL6o2/
I have 3 image,
first image position is left. It's ok.
third image position is right. It's ok.
But i have issue on second image, how can i move second image to center [responsive design] ?
<div style="position: relative;width: 100%;height: 40px;text-align: center;background-color: #373737;padding: 10px 0px;">
<div style=" display: block; position: relative; margin: 4px 0px; float: left; margin-left: 1.5%;">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
<div style=" display: block; position: relative; margin: 4px auto; float: left; ">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="width: 31px;height: 31px;border: none;" height="31px" width="111px">
</div>
<div style=" display: block; position: relative; margin: 4px 10px; float: right; margin-right: 1.5%; ">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
</div>
If you want to make element centered you can use margin: 0 auto, however - since your element is blocked it will take 100% of the width.
You can change that element to be inline-block and then use the margin: 0 auto to do the trick.
<div style="position: relative;width: 100%;height: 40px;text-align: center;background-color: #373737;padding: 10px 0px;">
<div style=" display: block; position: relative; margin: 4px 0px; float: left; margin-left: 1.5%;">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
<div style=" display: inline-block; position: relative; margin: 4px auto; ">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="width: 31px;height: 31px;border: none;" height="31px" width="111px">
</div>
<div style=" display: block; position: relative; margin: 4px 10px; float: right; margin-right: 1.5%; ">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
</div>
Regarding the comment about the 100%-width input in the center - check this fiddle:
https://jsfiddle.net/62b6prwo/
Remove the: float:left;
from the division and adjust the margin and padding to get the desired output.
You can do it like this :
<div style="position: relative;width: 100%;height: 40px;text-align: center;background-color: #373737;padding: 10px 0px;">
<div style="
display: block;
position: relative;
margin: 4px 0px;
float: left;
margin-left: 1.5%;
">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
<div style="
display: block;
position: absolute;
left: 0;
right: 0;
margin: 4px 0 4px ;
">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="width: 31px;height: 31px;border: none;" height="31px" width="111px">
</div>
<div style="
display: block;
position: relative;
margin: 4px 10px;
float: right;
margin-right: 1.5%;
">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
</div>
It sets the middle div to absolute, allowing you to move it to the center of the wrapper, by using left: 0; and right: 0;
This works, play around with the margin settings so you can position the third image without using negative top margin.
<div style="position: relative;width: 100%;height: 40px;text-align: center;background-color: #373737;padding: 10px 0px;">
<div style=" display: block; position: relative; margin: 4px 0px; float: left; margin-left: 1.5%;">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
<div style=" display: block; position: relative; margin: 4px auto; text-align: center; ">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="width: 31px;height: 31px;border: none;" height="31px" width="111px">
</div>
<div style=" display: block; position: absolute; right: 10px; margin-top: -35px; margin-right: 1.5%; ">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
</div>
Remove the float:left; on the middle div, and change the margin to margin:auto;.
Change the display on the divs from display:block; to display:inline; so they remain next to one another.
Change the middle image to position:relative; and add top:4px; to position vertically.
<div style="position: relative;width: 100%;height: 40px;text-align: center;background-color: #373737;padding: 10px 0px;">
<div style="
display: inline;
position: relative;
margin: 4px 0px;
float: left;
margin-left: 1.5%;
">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
<div style="
display: inline;
position: relative;
margin:auto;
">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="width: 31px;height: 31px;border: none; position:relative; top:4px;" height="31px" width="111px">
</div>
<div style="
display: inline;
position: relative;
margin: 4px 10px;
float: right;
margin-right: 1.5%;
">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg" style="/* margin: 16px auto; */height: 31px;border: none;width: 31px;" height="31px" width="111px">
</div>
</div>
Please see:
https://jsfiddle.net/ydufL6o2/4/
NOTE
Inline styling is NOT the way to style elements. It should be done in the stylesheet or in the style tags in the head part of the HTML. Here is the proper code.
Basically I cleaned up your code A LOT by adding IDs and classes.
What you had to do is remove the float: left property from the middle div.
After that, you have to change the display: block; to display: inline-block, as I did in the childDiv class divs.
That solves the problem, as shown in this snippet.
#parentDiv {
position: relative;
width: 100%;
height: 40px;
text-align: center;
background-color: #373737;
padding: 10px 0px;
}
.childDiv {
display: inline-block;
position: relative;
margin: 4px 0px;
}
img {
height: 31px;
border: none;
width: 31px;
}
<div id="parentDiv">
<div class="childDiv" style="float: left; margin-left: 1.5%;">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg">
</div>
<div class="childDiv">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg">
</div>
<div class="childDiv" style="float: right; margin-right: 1.5%;">
<img src="https://thumb-cc.s3.envato.com/files/189105725/KMRS%20Thumbnail.jpg">
</div>
</div>
Related
This question already has answers here:
Align inline-block DIVs to top of container element
(5 answers)
Closed 2 years ago.
I trying to make a 2 parallel div in center to show the user info. Left div contain the user image and the name while the right div show the login details such as login name, position, department and etc. I been try set the line height same as my div height but the result is not what i want, or may be the line height doesn't fix the issue or i using the wrong way to achieve this. Beside this, I have try set the both div to inline-flex and make the 2 div float left. This can make the 2 div in parallel but not in the center of the page. Any better way to achieve this?
my code
<div style="text-align: center; width: 80%; margin: auto;">
<div
style="
display: inline-block;
width: 240px;
height: 270px;
text-align: center;
box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2);
"
>
<img
id="pf-img"
style="display: block; text-align: center; margin: 21px 45px 0px; border-radius: 50%; box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2);"
src="/assets/images/avatar_v3.png"
alt=""
width="150px"
/>
<div style="margin: 40px 0px;">
<span>Name</span>
</div>
</div>
<div style="display: inline-block; margin-left: 30px;">
<div style="display: block; box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
<div style="display: block; box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px; margin-top: 38px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
<div style="box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px; margin-top: 38px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
<div style="box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px; margin-top: 38px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
</div>
</div>
My result:
my result image
I am not sure why you are bringing up flex when you are not using such CSS feature.
Adding the CSS property vertical-align: top; to left column should do the trick.
<div style="text-align: center; width: 80%; margin: auto;">
<div
style="
display: inline-block;
width: 240px;
height: 270px;
text-align: center;
vertical-align: top;
box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2);
"
>
<img
id="pf-img"
style="display: block; text-align: center; margin: 21px 45px 0px; border-radius: 50%; box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2);"
src="/assets/images/avatar_v3.png"
alt=""
width="150px"
/>
<div style="margin: 40px 0px;">
<span>Name</span>
</div>
</div>
<div style="display: inline-block; margin-left: 30px;">
<div style="display: block; box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
<div style="display: block; box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px; margin-top: 38px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
<div style="box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px; margin-top: 38px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
<div style="box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2); padding: 10px; margin-top: 38px;">
<div style="display: inline-block; width: 280px; text-align: left;">Login Name</div>
<div style="display: inline-block; width: auto;">Login Name</div>
</div>
</div>
</div>
Okay, before that I have some tips:
1 ° Avoid in-line styling
This makes the HTML code confusing, difficult to read
2 ° Use CSS classes
Classes allow you to apply the same style to several elements at the same time
3 ° Use correct marking
Divs are generic containers for other elements. They serve to group and separate elements of the page. You have only used divs to structure the entire page, not taking advantage of the semantic meaning of other elements of HTML.
Having made these observations, the solution I propose is as follows:
<!DOCTYPE html>
<html>
<head>
<style>
.user-info-container {
display:flex;
}
.user-img {
margin-right: 1rem;
}
.user-img img {
width: 100%;
height: auto;
}
.user-info-badge {
display:flex;
align-items:center;
box-shadow: 0 .5px 5px 0 rgba(0,0,0,0.2);
padding: 0.5rem 1rem;
margin-bottom: 1rem;
}
.user-info-badge:last-child {
margin-bottom: 0;
}
.user-info-badge h3 {
width: 150px;
text-align:left;
}
</style>
</head>
<body>
<div class="user-info-container">
<div class="user-img">
<img src="/assets/images/avatar_v3.png">
</div>
<div class="user-info-badges">
<div class="user-info-badge">
<h3>Username</h3>
<span>teste183</span>
</div>
<div class="user-info-badge">
<h3>Email</h3>
<span>teste.teste#teste.com</span>
</div>
<div class="user-info-badge">
<h3>Nascimento</h3>
<span>05-02-2020</span>
</div>
</div>
</div>
</body>
</html>
I have some text and I want to display a small picture to the left of it, and then on the right side of the text, but I'm not to sure how to do this and make it responsive, so that it all shrinks together when the screen gets smaller.
I'm using bootstrap 3, so far I have:
HTML:
#restaurant-menu img {
width: 100px;
display:inline-block;
vertical-align:top;
}
.border {
display: block;
height: 2px;
margin-top: 30px;
margin-bottom: 30px;
width: 78px;
background: #F8BD23;
margin: 0 auto;
}
h1 {
font-weight: 200;
font-size: 65px;
letter-spacing: 0px;
line-height: 50px;
color: black;
padding-top: 20px;
margin-bottom: 3px;
text-align: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="left">
<img class="img-responsive" src="img/g.png" style="margin: auto;">
</div>
<div class="mid">
<h1>Priserna</h1>
<span class="border"></span>
<p style="text-align: center;margin-top: 15px;">Nedan hittar du alla våra tjänster vi har att erbjuda</p>
</div>
<div class="right">
<img class="img-responsive" src="img/g.png" style="margin: auto;">
</div>
Any help on making 2 images appear on the left side of the text and the right side would be great ,
thanks
Wrap your divs in a container (here flex-container) and give it the attribute of display:flex as shown :
.flex-container {
display: flex; /*Generates a flexbox layout with default flex direction as row */
width: 100%; /* Not really required */
align-items: center; /*Aligns contents vertically */
justify-content: center; /*Aligns contents horizontally */
text-align: center; /*Aligns further text in the center */
}
#restaurant-menu img {
width: 100px;
display: inline-block;
vertical-align: top;
}
.border {
display: block;
height: 2px;
margin-top: 30px;
margin-bottom: 30px;
width: 78px;
background: #F8BD23;
margin: 0 auto;
}
h1 {
font-weight: 200;
font-size: 65px;
letter-spacing: 0px;
line-height: 50px;
color: black;
padding-top: 20px;
margin-bottom: 3px;
text-align: center;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="flex-container">
<div class="left">
<img class="img-responsive" src="https://pbs.twimg.com/profile_images/604644048/sign051.gif" style="margin: auto;">
</div>
<div class="mid">
<h1>Priserna</h1>
<span class="border"></span>
<p style="text-align: center;margin-top: 15px;">Nedan hittar du alla våra tjänster vi har att erbjuda</p>
</div>
<div class="right">
<img class="img-responsive" src="https://pbs.twimg.com/profile_images/604644048/sign051.gif" style="margin: auto;">
</div>
</div>
Using percentages as a width will do the trick, and make it responsive
.left,.mid,.right{
float:left;
}
.left,.right{
width:25%;
}
.left img,.right img{
width:100%;
}
.mid{
width:50%;
}
#restaurant-menu img {
width: 100px;
display:inline-block;
vertical-align:top;
}
.border {
display: block;
height: 2px;
margin-top: 30px;
margin-bottom: 30px;
width: 78px;
background: #F8BD23;
margin: 0 auto;
}
h1 {
font-weight: 200;
font-size: 65px;
letter-spacing: 0px;
line-height: 50px;
color: black;
padding-top: 20px;
margin-bottom: 3px;
text-align: center;
}
<div class="left">
<img class="img-responsive" src="https://vignette.wikia.nocookie.net/geosworld/images/0/09/Toon_link.jpg/revision/latest?cb=20131223183834" style="margin: auto;">
</div>
<div class="mid">
<h1>Priserna</h1>
<span class="border"></span>
<p style="text-align: center;margin-top: 15px;">Nedan hittar du alla våra tjänster vi har att erbjuda</p>
</div>
<div class="right">
<img class="img-responsive" src="https://vignette.wikia.nocookie.net/geosworld/images/0/09/Toon_link.jpg/revision/latest?cb=20131223183834" style="margin: auto;">
</div>
You can try flex like this :
.content {
display: flex;
align-items: center;
justify-content: center;
}
#restaurant-menu img {
width: 100px;
display: inline-block;
vertical-align: top;
}
.border {
display: block;
height: 2px;
margin-top: 30px;
margin-bottom: 30px;
width: 78px;
background: #F8BD23;
margin: 0 auto;
}
h1 {
font-weight: 200;
font-size: 65px;
letter-spacing: 0px;
line-height: 50px;
color: black;
padding-top: 10px;
margin-bottom: 3px;
text-align: center;
}
<div class="content">
<div class="left">
<img class="img-responsive" src="https://lorempixel.com/100/100/" style="margin: auto;">
</div>
<div class="mid">
<h1>Priserna</h1>
<span class="border"></span>
<p style="text-align: center;margin-top: 15px;">Nedan hittar du alla våra tjänster vi har att erbjuda</p>
</div>
<div class="right">
<img class="img-responsive" src="https://lorempixel.com/100/100/" style="margin: auto;">
</div>
</div>
Or a simple inline-block solution :
.content {
text-align: center;
}
.left,
.mid,
.right {
display: inline-block;
vertical-align: top;
}
#restaurant-menu img {
width: 100px;
display: inline-block;
vertical-align: top;
}
.border {
display: block;
height: 2px;
margin-top: 30px;
margin-bottom: 30px;
width: 78px;
background: #F8BD23;
margin: 0 auto;
}
h1 {
font-weight: 200;
font-size: 65px;
letter-spacing: 0px;
line-height: 50px;
color: black;
margin-bottom: 3px;
text-align: center;
}
<div class="content">
<div class="left">
<img class="img-responsive" src="https://lorempixel.com/100/100/" style="margin: auto;">
</div>
<div class="mid">
<h1>Priserna</h1>
<span class="border"></span>
<p style="text-align: center;margin-top: 15px;">Nedan hittar du alla våra tjänster vi har att erbjuda</p>
</div>
<div class="right">
<img class="img-responsive" src="https://lorempixel.com/100/100/" style="margin: auto;">
</div>
</div>
try adding this classes. You can also try to change the width as you wish and make use of media queries to handle the breakpoints to make it responsive.
.left{
width: 10%;
display: inline-block;
}
.mid{
display:inline-block;
}
.right{
width: 10%;
display : inline-block;
}
You can also try this instead
<div class="row">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="left">
<img class="img-responsive" src="https://www.w3schools.com/w3css/img_fjords.jpg" style="margin: auto;">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="mid">
<h1>Priserna</h1>
<span class="border"></span>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="left">
<img class="img-responsive" src="https://www.w3schools.com/w3css/img_fjords.jpg" style="margin: auto;">
</div>
</div>
</div>
<p style="text-align: center;margin-top: 15px;">Nedan hittar du alla våra tjänster vi har att erbjuda</p>
If this isn't the result you wanted, then can you give some more details or reference to what you actually want to achieve
I tried using below code but the heading comes in next line.
The code is given below :
<div style="display:inline;">
<img src="abc.png" style="margin:10px 10px 10px 10px;width:97px;height:50px;" />
<h5 style="display:inline-block">Hello</h5></div>
Expected Output!!
Change your styles like below. Add float:left; to both img and h5 tags to get your result.
UPDATED OUTPUT
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div style="display: inline-block;width: 100%;">
<img src="https://smallbusinesssaturdayuk.com/Images/Small-Business-Saturday-UK-Google-Plus.gif" style="float:left;" />
<h5 style="text-align:center;">Hello</h5>
</div>
</body>
</html>
Here I used inline styles as you are using that. But always try to avoid inline styles.
<div style="display: inline-block;width: 100%;text-align: center;">
<img src="https://placeholdit.imgix.net/~text?txtsize=12&txt=97%C3%9750&w=97&h=50" alt="img" style="text-align: left;float: left;" />
<h5 style="margin: 17px 0;">Hello</h5>
</div>
div {
display: flex;
align-items: center;
}
img {
margin: 10px 10px 10px 10px;
width: 97px;
height: 50px;
flex: 0 0;
}
h5 {
padding: 0;
margin: 0;
flex: 1 0;
text-align: center;
}
.div {
position: relative;
min-height: 70px;
}
.img {
position: absolute;
left: 0;
top: 0;
}
<h4>Center of text part</h4>
<div>
<img src="http://beerhold.it/97/50">
<h5>Hello</h5>
</div>
<hr>
<h4>Center of vieport</h4>
<div class="div">
<img class="img" src="http://beerhold.it/97/50">
<h5>Hello</h5>
</div>
Its on the same line
<div style="display:inline;background:red; float: left;">
<img src="http://image.flaticon.com/icons/png/128/33/33702.png" style="margin:10px 10px 10px 10px;width:97px;height:50px;"><h5 style="display:inline-block; background:blue;color:#fff; vertical-align:top;">Hello</h5></div>
Use vertical-align to align elements vertically (does not work for block elements).
div {
display: inline
}
h5 {
display: inline-block;
vertical-align: middle;
}
img {
margin: 10px;
width: 97px;
height: 50px;
vertical-align: middle;
}
<div>
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=350&h=150" />
<h5>Hello</h5>
</div>
I didn't understand what's your problem. Just try this..
<div style="display:inline;">
<img src="abc.png" style="float:left; margin:10px 10px 10px 10px;width:97px;height:50px;" />
<h5 style="display:inline-block;">Hello</h5></div>
I am trying to refine the fluid design of my website, such that it will work down to 480px width. I have a section almost done but am hung up on the footer fixed to the bottom.
It does what i want except i can't get the img to align beside the text in the middle. The img keeps getting pushed down. Link
html:
<footer>
<div class="bottom" style="width: 30%;"> </div>
<div class="bottom" style="width: 30%;">
<div style="text-align: right;">
kim#<br>briligg.com
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png"
title="This work is licensed under a Creative Commons Attribution 4.0 International License. If you use this
work, attribute it to Kim Holder, and briligg.com."/>
</a>
</div>
</div>
<div class="bottom" style="width: 30%;"> </div>
</footer>
css:
footer {
width: 100%;
height: 45px;
position: fixed;
bottom: 0px;
background-color: #000015;
}
div.bottom {
float: left;
margin: 10px auto;
height: 40px;
color: #9dab71;
font-size: 0.8em;
display: inline;
}
div.bottom div {
display: inline;
}
div.bottom img {
float: right;
padding: 5px;
margin: 2px auto;
}
It feels like this should be easy and i'm just missing something. :P
reduce margins
margin: 5px auto;
instead of float img to right, parent div floated to right
and use display: inline-block; for text
https://jsfiddle.net/kokilajs/pt69y332/6/
<footer>
<div class="bottom" style="width: 33%;"> </div>
<div class="bottom" style="width: 33%;">
<div style="text-align: right;">
kim#<br/>briligg.com
</div>
<div id="test" >
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png"
title="This work is licensed under a Creative Commons Attribution 4.0 International License. If you use this
work, attribute it to Kim Holder, and briligg.com."/>
</a>
</div>
</div>
<div class="bottom" style="width: 33%;"> </div>
</footer>
Style :
footer {
width: 100%;
height: 45px;
position: fixed;
bottom: 0px;
background-color: #000015;
}
div.bottom {
float: left;
margin: 5px auto;
height: 40px;
color: #9dab71;
font-size: 0.8em;
display: inline;
}
div.bottom div {
display: inline-block;
}
#test{
float: right;
margin: 0;
}
I'm trying to create a responsive grid of thumbnails using portrait and landscape images in HTML/CSS for Blogger. I haven't found any pre-made solutions that account for images in different orientations. I previously used the following code, but it's very cumbersome to use and uses tables:
<table style="margin-left:-3px;" border="0">
<tr><td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 100px; margin: -14px -20px 0px 0px;">
<a href="http://1.bp.blogspot.com/-PPFiMVxvw5Y/UWtx6pU68YI/AAAAAAAAAHg/j8bXN4KHUBU/s1600/4-108.jpg" imageanchor="1" title="Daylight">
<img style="position: absolute; top:-50px; border="0" src="http://1.bp.blogspot.com/-PPFiMVxvw5Y/UWtx6pU68YI/AAAAAAAAAHg/j8bXN4KHUBU/s150/4-108.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 100px; margin: -14px -20px 0px 0px;">
<a href="http://1.bp.blogspot.com/-pchlGmQn8xU/UWtyEKIbKFI/AAAAAAAAAIQ/IUH8v3Pk9AE/s1600/4-71.jpg" imageanchor="1" title="Daylight">
<img style="position: absolute; top:-50px; border="0" src="http://1.bp.blogspot.com/-pchlGmQn8xU/UWtyEKIbKFI/AAAAAAAAAIQ/IUH8v3Pk9AE/s150/4-71.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://3.bp.blogspot.com/-k5oXNNfTR2o/UWtx7DHQMSI/AAAAAAAAAHo/IcfBH1B2Nr0/s1600/4-141.jpg" imageanchor="1" title="Hostage Calm">
<img style="position: absolute; left:-35px; border="0" src="http://3.bp.blogspot.com/-k5oXNNfTR2o/UWtx7DHQMSI/AAAAAAAAAHo/IcfBH1B2Nr0/s150/4-141.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://2.bp.blogspot.com/-h-NZD0TSM4A/UWtx8VVYIII/AAAAAAAAAHw/Lf5_ohJl-BQ/s1600/4-153.jpg" imageanchor="1" title="Hostage Calm">
<img style="position: absolute; left:-35px; border="0" src="http://2.bp.blogspot.com/-h-NZD0TSM4A/UWtx8VVYIII/AAAAAAAAAHw/Lf5_ohJl-BQ/s150/4-153.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://1.bp.blogspot.com/-pns3r8rdUVA/UWwszQPxmlI/AAAAAAAAAJU/c_MCm6pAQcM/s1600/4-131.jpg" imageanchor="1" title="Mixtapes">
<img style="position: absolute; left:-35px; border="0" src="http://1.bp.blogspot.com/-pns3r8rdUVA/UWwszQPxmlI/AAAAAAAAAJU/c_MCm6pAQcM/s150/4-131.jpg" />
</a></div>
</td></tr>
<tr><td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://1.bp.blogspot.com/-g6od5jPw2To/UWws0cT-CCI/AAAAAAAAAJg/Zbt9oWC8MFg/s1600/4-132.jpg" imageanchor="1" title="Mixtapes">
<img style="position: absolute; left:-35px; border="0" src="http://1.bp.blogspot.com/-g6od5jPw2To/UWws0cT-CCI/AAAAAAAAAJg/Zbt9oWC8MFg/s150/4-132.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 100px; margin: -14px -20px 0px 0px;">
<a href="http://4.bp.blogspot.com/-I4U9DF5jpUA/UWws0beG4jI/AAAAAAAAAJc/47wjlevC34k/s1600/4-42.jpg" imageanchor="1" title="You Blew It!">
<img style="position: absolute; top:-50px; border="0" src="http://4.bp.blogspot.com/-I4U9DF5jpUA/UWws0beG4jI/AAAAAAAAAJc/47wjlevC34k/s150/4-42.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://4.bp.blogspot.com/-rXjeRPm-XaU/UWws1EOjb9I/AAAAAAAAAJs/EEyk5RXHjsE/s1600/4-44.jpg" imageanchor="1" title="You Blew It!">
<img style="position: absolute; left:-35px; border="0" src="http://4.bp.blogspot.com/-rXjeRPm-XaU/UWws1EOjb9I/AAAAAAAAAJs/EEyk5RXHjsE/s150/4-44.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://4.bp.blogspot.com/-BXnqebnoEdg/UWws2twugaI/AAAAAAAAAJ0/URAOyty5PdQ/s1600/4-46.jpg" imageanchor="1" title="You Blew It!">
<img style="position: absolute; left:-35px; border="0" src="http://4.bp.blogspot.com/-BXnqebnoEdg/UWws2twugaI/AAAAAAAAAJ0/URAOyty5PdQ/s150/4-46.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://1.bp.blogspot.com/-ZktVzEjRh6A/UWws2j8d26I/AAAAAAAAAJ4/msp0x00Qli0/s1600/4-58.jpg" imageanchor="1" title="You Blew It!">
<img style="position: absolute; left:-35px; border="0" src="http://1.bp.blogspot.com/-ZktVzEjRh6A/UWws2j8d26I/AAAAAAAAAJ4/msp0x00Qli0/s150/4-58.jpg" />
</a></div>
</td></tr>
<tr><td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 100px; margin: -14px -20px 0px 0px;">
<a href="http://3.bp.blogspot.com/-Hljl68Y-3Bs/UWx446aZ83I/AAAAAAAAAKs/NrmAXgZ4SyY/s1600/4-5.jpg" imageanchor="1" title="Ages">
<img style="position: absolute; top:-50px; border="0" src="http://3.bp.blogspot.com/-Hljl68Y-3Bs/UWx446aZ83I/AAAAAAAAAKs/NrmAXgZ4SyY/s150/4-5.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://4.bp.blogspot.com/-JUkUq0Mjcy0/UWx47mM7-DI/AAAAAAAAAK0/MyMht6reYeU/s1600/4-7.jpg" imageanchor="1" title="Ages">
<img style="position: absolute; left:-35px; border="0" src="http://4.bp.blogspot.com/-JUkUq0Mjcy0/UWx47mM7-DI/AAAAAAAAAK0/MyMht6reYeU/s150/4-7.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://2.bp.blogspot.com/-QhSig2DBDbo/UWx4iRPDEWI/AAAAAAAAAKM/gm8gz2lUBG8/s1600/4-137.jpg" imageanchor="1" title="Candy Hearts">
<img style="position: absolute; left:-35px; border="0" src="http://2.bp.blogspot.com/-QhSig2DBDbo/UWx4iRPDEWI/AAAAAAAAAKM/gm8gz2lUBG8/s150/4-137.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 100px; margin: -14px -20px 0px 0px;">
<a href="http://4.bp.blogspot.com/-jeYg22ByEiY/UWx4iUQpwxI/AAAAAAAAAKQ/7c9fiShT5y8/s1600/4-136.jpg" imageanchor="1" title="Candy Hearts">
<img style="position: absolute; top:-50px; border="0" src="http://4.bp.blogspot.com/-jeYg22ByEiY/UWx4iUQpwxI/AAAAAAAAAKQ/7c9fiShT5y8/s150/4-136.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 12px 0px;">
<a href="http://2.bp.blogspot.com/-ZY5qFY12QUI/UWx4oR14wKI/AAAAAAAAAKc/SW3BWT67pvA/s1600/4-38.jpg" imageanchor="1" title="Light Years">
<img style="position: absolute; left:-35px; border="0" src="http://2.bp.blogspot.com/-ZY5qFY12QUI/UWx4oR14wKI/AAAAAAAAAKc/SW3BWT67pvA/s150/4-38.jpg" />
</a></div>
</td></tr>
<tr><td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 100px; margin: 0px 12px 0px 0px;">
<a href="http://4.bp.blogspot.com/-RmmoPSuQips/UWx4vz9q2_I/AAAAAAAAAKk/PjaPD0VG8yc/s1600/4-44.jpg" imageanchor="1" title="Light Years">
<img style="position: absolute; top:-50px; border="0" src="http://4.bp.blogspot.com/-RmmoPSuQips/UWx4vz9q2_I/AAAAAAAAAKk/PjaPD0VG8yc/s150/4-44.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 120px; margin: -18px 14px 0px 0px;">
<a href="http://3.bp.blogspot.com/-UOzGYBBVICE/UWtyBGWxZaI/AAAAAAAAAIA/LkpQ7_niHvo/s1600/4-37.jpg" imageanchor="1" title="Turnover">
<img style="position: absolute; left:-35px; border="0" src="http://3.bp.blogspot.com/-UOzGYBBVICE/UWtyBGWxZaI/AAAAAAAAAIA/LkpQ7_niHvo/s150/4-37.jpg" />
</a></div>
</td> <td><div class="separator" style="clear: both; border: none; overflow: hidden; position: relative; width: 100px; height: 100px; margin: 0px 12px 0px 0px;">
<a href="3.bp.blogspot.com/-XZ843zdMTdU/UWtyAzXH8zI/AAAAAAAAAH8/6UwT0Gp3Ohg/s1600/4-21.jpg" imageanchor="1" title="Turnover">
<img style="position: absolute; top:-50px; border="0" src="3.bp.blogspot.com/-XZ843zdMTdU/UWtyAzXH8zI/AAAAAAAAAH8/6UwT0Gp3Ohg/s150/4-21.jpg" />
</a></div>
</td></tr>
</table>
Any help would be greatly appreciated!
For this I would recommend looking into Bootstrap; more precisely the Bootstrap grid system.
It looks like you have a lot of code right there. Bootstrap makes it easy and concise.
A solution with Bootstrap:
<div class="row">
<div class="col-md-4">your image</div>
<div class="col-md-4">your image</div>
<div class="col-md-4">your image</div>
</div>
<div class="row">
<div class="col-md-4">your image</div>
<div class="col-md-4">your image</div>
<div class="col-md-4">your image</div>
</div>
<div class="row">
<div class="col-md-4">your image</div>
<div class="col-md-4">your image</div>
<div class="col-md-4">your image</div>
</div>
Here you have 3 rows and in every row 3 column. Then, you can do the necessary to add your images.
#media only screen and (min-width:321px){ table,tr,td, thead, tbody,th {display:block;clear:both;width:100%;height:auto}
}