Change image size on hover, makes other images wrap - html

I'm building a 3x3 grid of thumbnails. A 'hover' effect makes the thumbnails grow. But the other images in the gallery move out or under the one that is growing. How can I fix it?
If there's a CSS solution, that would be great. Otherwise, I'm open to using jQuery.
.galeria {
margin-top: 15px;
width: 400px;
height: 520px;
border: 3px solid black;
border-radius: 15px;
}
#vis2 {
text-align: center;
}
.imgs {
display: inline-block;
margin-left: 20px;
}
.despliegue {
width: 95px;
height: 95px;
border: 3px dashed yellow;
border-radius: 100%;
padding: 10px 10px 10px 10px;
align-items: center;
margin-top: 15px;
position: sticky;
}
.despliegue:hover {
width: 140px;
height: 140px;
position: static;
}
.pieimg {
display: none;
}
.despliegue:hover + .pieimg {
display: block;
font-style: normal;
position: absolute;
}
<div class="galeria">
<h4 id="vis2">Dale un vistazo a las notas relevantes</h4>
<div class="imgs">
<img class="despliegue" src="images/aurora.jpg">
<p class="pieimg">Aurora gana premio !en Europa¡</p>
<img class="despliegue" src="images/bio.jpg">
<p class="pieimg">Bioshock se posiciona</p>
<img class="despliegue" src="images/amazon.jpg">
<p class="pieimg">Amazon, vuelve a dar de que hablar</p>
</div>
<div class="imgs">
<img class="despliegue" src="images/guerra.png">
<p class="pieimg">Microsoft, Android y Apple ¿Quien lleva cabeza?</p>
<img class="despliegue" src="images/windows.png">
<p class="pieimg">Windows 10. Te damos consejos</p>
<img class="despliegue" src="images/carlos.jpg">
<p class="pieimg">Carlos Sadness dice que podría venir a LATAM para 2015</p>
</div>
<div class="imgs">
<img class="despliegue" src="images/las_ventajas.jpg">
<p class="pieimg">Nota de: Película</p>
<img class="despliegue" src="images/mcw.png">
<p class="pieimg">Microsoft ataca con nueva <b>Surface</b>
</p>
<img class="despliegue" src="images/netflix.png">
<p class="pieimg">El éxito detras de tan famosa plataforma</p>
</div>
</div>
View on CodePen

It's spilling on to the next line because the container div is not big enough to hold the new larger img along with the other two.
By increasing the width on .galeria to something like 450px, it eliminates this issue.
Add width: 450px; to .galeria, adjust the width until it looks right. :)
.galeria {
margin-top: 15px;
width: 450px;
height: 520px;
border: 3px solid black;
border-radius: 15px;
}
#vis2 {
text-align: center;
}
.imgs {
display: inline-block;
margin-left: 20px;
}
.despliegue {
width: 95px;
height: 95px;
border: 3px dashed yellow;
border-radius: 100%;
padding: 10px 10px 10px 10px;
align-items: center;
margin-top: 15px;
position: sticky;
}
.despliegue:hover {
width: 140px;
height: 140px;
position: static;
}
.pieimg {
display: none;
}
.despliegue:hover + .pieimg {
display: block;
font-style: normal;
position: absolute;
}
<div class="galeria">
<h4 id="vis2">Dale un vistazo a las notas relevantes</h4>
<div class="imgs">
<img class="despliegue" src="images/aurora.jpg">
<p class="pieimg">Aurora gana premio !en Europa¡</p>
<img class="despliegue" src="images/bio.jpg">
<p class="pieimg">Bioshock se posiciona</p>
<img class="despliegue" src="images/amazon.jpg">
<p class="pieimg">Amazon, vuelve a dar de que hablar</p>
</div>
<div class="imgs">
<img class="despliegue" src="images/guerra.png">
<p class="pieimg">Microsoft, Android y Apple ¿Quien lleva cabeza?</p>
<img class="despliegue" src="images/windows.png">
<p class="pieimg">Windows 10. Te damos consejos</p>
<img class="despliegue" src="images/carlos.jpg">
<p class="pieimg">Carlos Sadness dice que podría venir a LATAM para 2015</p>
</div>
<div class="imgs">
<img class="despliegue" src="images/las_ventajas.jpg">
<p class="pieimg">Nota de: Película</p>
<img class="despliegue" src="images/mcw.png">
<p class="pieimg">Microsoft ataca con nueva <b>Surface</b>
</p>
<img class="despliegue" src="images/netflix.png">
<p class="pieimg">El éxito detras de tan famosa plataforma</p>
</div>
</div>

Related

How can I center my image + text and keep responsive?

here's the result I'd like to obtain once I'm reducing the window :
the problem in this result is that they aren't centered, once I center them that's what I get, I guess I'm doing something wrong : the issue. This code is the one that cause the issue when they're centered.
Here's my code :
section {
margin-top: 25px;
padding: 24px;
box-sizing: border-box;
}
h2 {
margin-bottom: 30px;
text-align: center;
font-weight: bold;
font-size: 22px;
}
.flex-container {
display: flex;
flex-direction: column;
align-content: flex-start;
height: 100%;
padding: 15x;
}
.flex-container > div{
position: relative;
left: 21%;
border-radius: 5px;
padding: 8px;
}
.articleactu img {
float: left;
border-radius: 15px;
max-width: 210px;
}
p {
word-wrap: break-word;
max-width: 900px;
padding-left: 200px;
}
#titre {
line-height: px;
font-weight: bold;
}
#date {
font-size: 14px;
font-weight: bold;
color: #662189;
}
hr.solid {
position: relative;
left: 21%;
width: 50%;
opacity: 12%;
}
div p ,#titre ,#date {
margin-left: 35px;
}
<!-- ACTUALITÉ - ARTICLES -->
<section>
<h2> L'ACTUALITÉ </h2>
<article class="articleactu">
<div class="flex-container">
<div>
<img src="images/gtaarticle.jpeg" alt="Article GTA " class="center">
<p id="titre">GTA : THE TRILOGY DEFINITIVE EDITION, les fans sont déçus !</p>
<p> Les joueurs attendaient une refonte complète de la trilogie afin de rappeler de lointains souvenirs mais malheureusement les fans sont déçus...</p>
<p id="date"> Publié le 27 novembre 2021 </p>
</div>
<hr class="solid">
<div>
<img src="images/bf2042-2.jpg" alt="Article GTA " class="center">
<p id="titre">BATTLEFIELD 2042 : De très mauvaise notes pour le nouvel opus.</p>
<p> Le lancement du jeu est malheureusement un raté... Un jeu rempli de bugs, on repense évidemment à Cyberpunk 2077...</p>
<p id="date"> Publié le 26 novembre 2021 </p>
</div>
<hr class="solid">
</article>
</section>
I hope that anyone can help me with this. Thanks in advance !
The main reason is
.flex-container > div{
left: 21%;
}
Then, that div has full width(100%) but the left position has 21%. So the content will look on the left side.
Try like this.
section {
margin-top: 25px;
padding: 24px;
box-sizing: border-box;
}
h2 {
margin-bottom: 30px;
text-align: center;
font-weight: bold;
font-size: 22px;
}
.flex-container {
display: flex;
flex-direction: column;
align-content: flex-start;
height: 100%;
padding: 10%;
}
.flex-container > div {
display: flex;
}
.flex-container > div > div {
float: left;
}
.description {
margin-left: 20px;
}
.articleactu img {
border-radius: 15px;
max-width: 210px;
}
p {
word-wrap: break-word;
}
#titre {
line-height: px;
font-weight: bold;
}
#date {
font-size: 14px;
font-weight: bold;
color: #662189;
}
hr.solid {
position: relative;
width: 50%;
opacity: 12%;
}
your HTML
<section>
<h2> L'ACTUALITÉ </h2>
<article class="articleactu">
<div class="flex-container">
<div style="display: flex">
<div>
<img src="images/gtaarticle.jpeg" alt="Article GTA " class="center">
</div>
<div class="description">
<p id="titre">GTA : THE TRILOGY DEFINITIVE EDITION, les fans sont déçus !</p>
<p> Les joueurs attendaient une refonte complète de la trilogie afin de rappeler de lointains souvenirs mais malheureusement les fans sont déçus...</p>
<p id="date"> Publié le 27 novembre 2021 </p>
</div>
</div>
<hr class="solid">
<div>
<div>
<img src="images/bf2042-2.jpg" alt="Article GTA " class="center">
</div>
<div class="description">
<p id="titre">BATTLEFIELD 2042 : De très mauvaise notes pour le nouvel opus.</p>
<p> Le lancement du jeu est malheureusement un raté... Un jeu rempli de bugs, on repense évidemment à Cyberpunk 2077...</p>
<p id="date"> Publié le 26 novembre 2021 </p>
</div>
</div>
<hr class="solid">
</div>
</article>
</section>

Excess white space on webpage when shrunk

I'm trying to fix when I shrink my website down to 768 pixels there seems to be too much whitespace on the left side, I am unable to work out where it is coming from and how I can fix it, I've tried to remove the default padding and margins, and changed the size of images, but that didn't seem to solve it. I will post some code. Any help would be appreciated.
{
margin: 0px;
padding: 0px;
}
div.item {
/* To correctly align image, regardless of content height: */
vertical-align: top;
display: inline-block;
/* To horizontally center images and caption */
text-align: center;
/* The width of the container also implies margin around the images. */
width: 120px;
position: relative;
left: 30%;
color: #f8d501;
}
img {
width: 100px;
height: 100px;
border: solid 5px #f8d501;
}
.caption {
/* Make the caption a block so it occupies its own line. */
display: block;
color: #f8d501;
}
div.item-1 {
/* To correctly align image, regardless of content height: */
vertical-align: top;
display: inline-block;
/* To horizontally center images and caption */
text-align: center;
/* The width of the container also implies margin around the images. */
width: 120px;
padding-top: 40px;
position: relative;
left: 30%;
color: yellow;
}
img {
max-width: 100%;
height: auto;
}
.caption-1 {
/* Make the caption a block so it occupies its own line. */
display: block;
color: #f8d501;
font-family: 'Verdana-bold';
}
h1 {
padding-top: 20px;
color: #fad700;
transform: rotate(-90deg);
font-size: 50px;
}
body {
background-color: #0d395e;
}
.logo-floatRight {
padding-left: 20px;
display: flex;
border: none;
max-width: 100%;
height: auto;
}
.logo-floatLeft {
padding-left: 20px;
display: inline-block;
border: none;
max-width: 100%;
height: auto;
padding: 10px;
}
.flex-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
padding-left: 35%;
max-width: 600px;
height: auto;
}
.logoHeader{
color: #f8d501;
font-family: "Franklin Gothic Heavy regular"
padding: 10px;
max-width: 100%;
height: auto;
}
.text{
color: #f8d501;
text-align: center;
padding-right: 30px;
}
.logo-floatLefts{
border: none;
width: 100%;
height: auto;
}
#media only screen and (max-width: 768px) {
img {
width: 60%;
}
.logoHeader{
font-size: 15px;
}
.flex-container{
width: 120px;
height: 120px;
}
.caption {
font-size: 12px;
}
.item {
font-size: 15px;
}
}
}
<div class="main">
<div class="showcase-content">
<div class="flex-container">
<img src="https://via.placeholder.com/150" class="logo-floatLeft" alt="logo">
<h2 class="logoHeader">LATIN<br>AMERICAN<br>FILM<br>FESTIVAL IN<br>AUSTRALIA</h2>
<img src="https://via.placeholder.com/150" class="logo-floatRight" alt="logo">
</div>
<div class="item">
BRAZIL
<img src="https://via.placeholder.com/150"/>
<span class="caption">LIFE IS A BITCH<br>Como e Cruel Viver Assim</span>
</div>
<div class="item">
CHILE
<img src="https://via.placeholder.com/150"/>
<span class="caption">BROKEN PANTIES<br>Colzones Ratos</span>
</div>
<div class="item">
COLOMBIA
<img src="https://via.placeholder.com/150"/>
<span class="caption">BAD LUCKY GOAT<br>El Dia De La Cabra</span>
</div>
<div class="item">
COSTA RICA
<img src="https://via.placeholder.com/150"/>
<span class="caption">THE GAZELLE'S DANCE<br>El Baile La Gacela </span>
</div>
<div class="item">
CUBA
<img src="https://via.placeholder.com/150"/>
<span class="caption">FALLEN GODS<br>Los Dioses Rotos</span>
</div>
<br>
<div class="item-1">
ECUADOR
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">QUIJOTES NEGROS<br>Quijotes Negros</span>
</div>
<div class="item-1">
EL SALVADOR
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">THE PATH OF THE SHADOWS<br>El Camino De Las Sombras</span>
</div>
<div class="item-1">
GAUTEMALA
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">WHERE ALL ROADS END<br>Donde Acaban Los Caminos.</span>
</div>
<div class="item-1">
MEXICO
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">MARA'AKAME'S DREAM<br>El Sueno Del Mara'akame</span>
</div>
<div class="item-1">
PANAMA
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">GRACE & SPLENDOUR<br>Donaire Y Esplendo</span>
</div>
<br>
<div class="item-1">
<h1> FREE<br>EVENT </h1>
</div>
<div class="item-1">
PARAGUAY
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">THE HEIRESSES<br>Las Herederas</span>
</div>
<div class="item-1">
PERU
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">OLD FRIENDS<br>Viejos Amigos</span>
</div>
<div class="item-1">
URUGUAY
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">THE POPES TOILET<br>El Bano Del Papa.</span>
</div>
<div class="item-1">
ARGENTINA
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">MAN FANCING SOUTHEAST<br>Hombre Mirando al Sudeste</span>
</div>
<div class="text">
<h3>FIND OUT WHEN FESTIVAL IS COMING TO YOUR CITY AT<br>WWW.FACEBOOK.COM/LAFFAUSSIE</h3>
<img src="footer.png" class="logo-floatLefts" alt="logo">
</div>
</div>
</div>
I just removed your extra margin and padding both from the item,item-1, flex-container class, and add only vertical-align and text-align center. And there is no extra margin or padding on the left. all the content remains in the center. Hope it will solve your problem. I also removed img and flex-container class from the media queries.
{
margin: 0px;
padding: 0px;
}
div.item {
/* To correctly align image, regardless of content height: */
vertical-align: top;
display: inline-block;
/* To horizontally center images and caption */
text-align: center;
/* The width of the container also implies margin around the images. */
width: 120px;
position: relative;
color: #f8d501;
}
img {
width: 100px;
height: 100px;
border: solid 5px #f8d501;
}
.caption {
/* Make the caption a block so it occupies its own line. */
display: block;
color: #f8d501;
}
div.item-1 {
/* To correctly align image, regardless of content height: */
vertical-align: top;
display: inline-block;
/* To horizontally center images and caption */
text-align: center;
/* The width of the container also implies margin around the images. */
width: 120px;
padding-top: 40px;
position: relative;
color: yellow;
}
img {
max-width: 100%;
height: auto;
}
.caption-1 {
/* Make the caption a block so it occupies its own line. */
display: block;
color: #f8d501;
font-family: 'Verdana-bold';
}
h1 {
padding-top: 20px;
color: #fad700;
transform: rotate(-90deg);
font-size: 50px;
}
body {
background-color: #0d395e;
}
.logo-floatRight {
border: none;
max-width: 100%;
height: auto;
padding: 10px;
}
.logo-floatLeft {
border: none;
max-width: 100%;
height: auto;
padding: 10px;
}
.center-text {
text-align: center;
}
.flex-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
}
.logoHeader{
color: #f8d501;
font-family: "Franklin Gothic Heavy regular"
padding: 10px;
max-width: 100%;
height: auto;
}
.text{
color: #f8d501;
text-align: center;
padding-right: 30px;
}
.logo-floatLefts{
border: none;
width: 100%;
height: auto;
}
#media only screen and (max-width: 768px) {
.logoHeader{
font-size: 15px;
}
.caption {
font-size: 12px;
}
.item {
font-size: 15px;
}
}
<div class="main">
<div class="showcase-content">
<div class="flex-container">
<img src="https://via.placeholder.com/150" class="logo-floatLeft" alt="logo">
<h2 class="logoHeader">LATIN<br>AMERICAN<br>FILM<br>FESTIVAL IN<br>AUSTRALIA</h2>
<img src="https://via.placeholder.com/150" class="logo-floatRight" alt="logo">
</div>
<div class="center-text">
<div class="item">
BRAZIL
<img src="https://via.placeholder.com/150"/>
<span class="caption">LIFE IS A BITCH<br>Como e Cruel Viver Assim</span>
</div>
<div class="item">
CHILE
<img src="https://via.placeholder.com/150"/>
<span class="caption">BROKEN PANTIES<br>Colzones Ratos</span>
</div>
<div class="item">
COLOMBIA
<img src="https://via.placeholder.com/150"/>
<span class="caption">BAD LUCKY GOAT<br>El Dia De La Cabra</span>
</div>
<div class="item">
COSTA RICA
<img src="https://via.placeholder.com/150"/>
<span class="caption">THE GAZELLE'S DANCE<br>El Baile La Gacela </span>
</div>
<div class="item">
CUBA
<img src="https://via.placeholder.com/150"/>
<span class="caption">FALLEN GODS<br>Los Dioses Rotos</span>
</div>
</div>
<br>
<div class="center-text">
<div class="item-1">
ECUADOR
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">QUIJOTES NEGROS<br>Quijotes Negros</span>
</div>
<div class="item-1">
EL SALVADOR
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">THE PATH OF THE SHADOWS<br>El Camino De Las Sombras</span>
</div>
<div class="item-1">
GAUTEMALA
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">WHERE ALL ROADS END<br>Donde Acaban Los Caminos.</span>
</div>
<div class="item-1">
MEXICO
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">MARA'AKAME'S DREAM<br>El Sueno Del Mara'akame</span>
</div>
<div class="item-1">
PANAMA
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">GRACE & SPLENDOUR<br>Donaire Y Esplendo</span>
</div>
</div>
<br>
<div class="center-text">
<div class="item-1">
<h1> FREE<br>EVENT </h1>
</div>
<div class="item-1">
PARAGUAY
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">THE HEIRESSES<br>Las Herederas</span>
</div>
<div class="item-1">
PERU
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">OLD FRIENDS<br>Viejos Amigos</span>
</div>
<div class="item-1">
URUGUAY
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">THE POPES TOILET<br>El Bano Del Papa.</span>
</div>
<div class="item-1">
ARGENTINA
<img src="https://via.placeholder.com/150"/>
<span class="caption-1">MAN FANCING SOUTHEAST<br>Hombre Mirando al Sudeste</span>
</div>
</div>
<div class="text">
<h3>FIND OUT WHEN FESTIVAL IS COMING TO YOUR CITY AT<br>WWW.FACEBOOK.COM/LAFFAUSSIE</h3>
<img src="footer.png" class="logo-floatLefts" alt="logo">
</div>
</div>
</div>
The padding:0 and margin:0 in the start are for body, which I think you have forgot to write.
If that doesn't solve, check each section by commenting to see which section is bigger in width to leave the white spaces.

How to have a picture by a header text

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

Drawing dots between two elements using background pic

I'm trying to draw a dotted line between some of my elements without success; I'm trying to accomplish something like the following:
I've looked at a few tutorials to write a line between the elements using the ::after pseudo-element, but I don't see anything happening.
.container {
width: 1066px;
margin: 0 auto;
}
.services {
text-align: center;
max-width: 1080px;
padding: 80px 0;
position: relative;
}
.services .step {
display: inline-block;
width: 152px;
height: 100px;
margin: 50px;
vertical-align: text-top;
}
.services .step .first {
float: right;
}
.services .icons {
background: url("https://www.icracked.com/themes/icracked/images/steps-line.png") repeat-x;
}
<div class="services container">
<div class="step first">
<strong>PASO 1</strong>
<br>
<p>Pon el codigo postal donde te encuentres</p>
</div>
<div class="step">
<strong>PASO 2</strong>
<br>
<p>Dinos qual es el problema</p>
</div>
<div class="step">
<STRONG>PASO 3</STRONG>
<br>
<p>Relajate, nuestro tecnico esta de camino</p>
</div>
<div class="step last">
<STRONG>PASO 4</STRONG>
<br>
<p>Voilà! En menos de una hora tienes el movil arreglado!</p>
</div>
<div class="icons">
<div class="step first">
<img src="http://via.placeholder.com/50x50" alt="" height="50" width="50"></div>
<div class="step">
<img src="http://via.placeholder.com/50x50" alt="" height="50" width="50"></div>
<div class="step">
<img src="http://via.placeholder.com/50x50" alt="" height="50" width="50"></div>
<div class="step last">
<img src="http://via.placeholder.com/50x50" alt="" height="50" width="50"></div>
</div>
</div>
http://jsfiddle.net/zhpmahnq/187/
You could try using display: flex; and creating a dotted border on only the top or bottom of a span between images.
.wrapper {
align-items: center;
display: flex;
justify-content: space-between; /* not necessary */
}
.dots {
border-top: 1px dotted black;
width: 100%;
}
https://jsfiddle.net/zhpmahnq/191/

Center <div> inside a <div>

Code: https://jsfiddle.net/z4udfg3o/
I want the divs "caixa" to be centered in the div "produtos". I was able to do it with exact values using margin-left. But I want it to be responsive for other screen sizes so I putted margin-left and margin-right as auto.
Image of desired format:
section {
padding: 2em 0;
display: flex;
justify-content: space-between;
background: antiquewhite;
}
section:before, section:after {
content: "";
}
div {
width: 10em;
height: 10em;
background: silver;
}
<section>
<div></div>
<div></div>
<div></div>
</section>
Use this CSS:
.produtos {
width: 100%;
background: gray;
margin-left: auto;
margin-right: auto;
display: inline-block;
}
.caixa {
width: 27.1%;
height: 250px;
background: darksalmon;
border: 1px solid #000;
float: left;
margin: 0 3%;
}
Like This?
.produtos {
width: 100%;
height: 252px;
background: gray;
text-align: center;
}
.caixa {
width: 250px;
height: 250px;
background: darksalmon;
border: 1px solid #000;
margin: 0 auto;
}
<div class="produtos">
<div class="caixa">
<img src="imagens/croa.png" style="margin-left:60px;">
<p style="text-align:center;">Temos os melhores produtos do mercado! Nossos competidores ajoelham-se perante a nossa qualidade!</p>
</div>
<div class="caixa">
<img src="imagens/dinheiro.png" style="margin-left:60px;">
<p style="text-align:center;">Preços mais baratos do mercado! Promoções 24/7! Se houver ofertas mais baratas diga e fazemos promoção de 0.01€!</p>
</div>
<div class="caixa">
<img href="#" src="imagens/definicoes.png" style="margin-left:60px;">
<p style="text-align:center;">Nosso departamento de apoio ao cliente está ativo 24/7! Resolveremos todas as suas dúvidas!</p>
</div>
</div>
Otherwise, i suggest you to have a look at flexbox
Do it like below:
#wrap {
background: #e7e7e7;
padding: 4px;
text-align: center;
width:100%;
}
#one, #two, #three {
background: #ccc;
display: inline-block;
padding: 20px;
width:20%;
}
<div id="wrap">
<div id="one">I am div 1</div>
<div id="two">I am div 2</div>
<div id="three">I am div 2</div>
</div>
try changing your css like below
.produtos
{
width: 100%;
height: 252px;
background: gray;
text-align: center;
}
.caixa
{
width: 250px;
height: 250px;
background: darksalmon;
border: 1px solid #000;
display: inline-block;
}
The following code sets the orange boxes as display: inline-block which causes them to follow the text flow, which is set to center in the parent container. This allows the boxes to flow depending on available screen space. On wide screens they're all side by side, on smaller ones they're arranged vertically.
I have also modified the HTML in order to get rid of newlines between the boxes. These newlines would cause margins otherwise.
.produtos
{
width: 100%;
background: gray;
text-align: center;
}
.caixa
{
vertical-align: top;
width: 250px;
height: 250px;
background: darksalmon;
border: 1px solid #000;
display: inline-block;
}
<div class="produtos">
<div class="caixa">
<img src="imagens/croa.png" style="margin-left:60px;">
<p style="text-align:center;">Temos os melhores produtos do mercado! Nossos competidores ajoelham-se perante a nossa qualidade!</p>
</div
><div class="caixa">
<img src="imagens/dinheiro.png" style="margin-left:60px;">
<p style="text-align:center;">Preços mais baratos do mercado! Promoções 24/7! Se houver ofertas mais baratas diga e fazemos promoção de 0.01€!</p>
</div
><div class="caixa">
<img href="#" src="imagens/definicoes.png" style="margin-left:60px;">
<p style="text-align:center;">Nosso departamento de apoio ao cliente está ativo 24/7! Resolveremos todas as suas dúvidas!</p>
</div>
</div>
I hope it works for you. I added each div class row for each to so you can set the padding in classemphasized text row.
.produtos
{
width: 100%;
height: 252px;
}
.caixa
{
width: 33%;
height: 100%;
background: darksalmon;
border:1px solid red;
float: left;
}
.row{
height:100%;
padding:0 20px;
}
<div class="produtos">
<div class="caixa">
<div class="row">
<img src="imagens/croa.png">
<p style="text-align:center;">Temos os melhores produtos do mercado! Nossos competidores ajoelham-se perante a nossa qualidade!</p>
</div>
</div>
<div class="caixa">
<div class="row">
<img src="imagens/dinheiro.png">
<p style="text-align:center;">Preços mais baratos do mercado! Promoções 24/7! Se houver ofertas mais baratas diga e fazemos promoção de 0.01€!</p>
</div> </div>
<div class="caixa">
<div class="row">
<img href="#" src="imagens/definicoes.png">
<p style="text-align:center;">Nosso departamento de apoio ao cliente está ativo 24/7! Resolveremos todas as suas dúvidas!</p>
</div> </div>
</div>
There are different ways, but if the boxes are to contain an image or something, then you will need a fixed aspect ratio, that can be accomplished like this:
.wrapper{float:left; width:100%; background-color:deeppink;}
.lil-box{float:left; width:22%; margin:0 5.665%; background-color:bisque;}
.tight-fit{float:left; width:100%; margin-top:100%;}
<div class="wrapper">
<div class="lil-box">
<div class="tight-fit"></div>
</div>
<div class="lil-box">
<div class="tight-fit"></div>
</div>
<div class="lil-box">
<div class="tight-fit"></div>
</div>
</div>
you should balance the width of both divs. "caixa" and "produtos".
I think using % will be responsive for other screeen size too.
Fiddle
Hope Fiddle link help you .