The top boxes are leaving extra space on the left for some reason but i'm not sure why. I would really appreciate your help.
HTML:
<section class="proj-box">
<div class="wrapper">
<div class="thumb" id="Dthumb">
<a href="Dough.html">
<img src="Doughblack.png" alt="screen mockups of Dough app">
</a>
<h3 id="Dtitle">Dough - Your new financial companion</h3>
</div>
<div class="thumb" id="Fthumb">
<a href="Flyte.html">
<img src="flytebig.png" alt="screen mockups of Flyte app">
</a>
<h3 id="Ftitle">Flyte - Flight Search App</h3>
</div>
<div class="thumb" id="Othumb">
<a href="OrderUp.html">
<img src="OrderUpred.png" alt="screen mockups of OrderUp app">
</a>
<h3 id="Otitle">OrderUp - Food Delivery App</h3>
</div>
</div>
</section>
CSS: The picture shows that the black box isn't aligned with the red box
.proj-box .thumb {
width: 380px;
height: 380px;
float: left;
margin: 20px 20px 0;
}
.proj-box img {
width: 380px;
border: 1px solid #ddd;
border-radius: 4px;
}
.proj-box img:hover {
box-shadow: 0 0 2px 1px #D89E9E;
}
You miss the "div" tag
<section class="proj-box">
<div class="wrapper">
<div class="thumb" id="Dthumb">
<a href="Dough.html">
<img src="Doughblack.png" alt="screen mockups of Dough app">
</a>
<h3 id="Dtitle">Dough - Your new financial companion</h3>
</div>
<div class="thumb" id="Fthumb">
<a href="Flyte.html">
<img src="flytebig.png" alt="screen mockups of Flyte app">
</a>
<h3 id="Ftitle">Flyte - Flight Search App</h3>
</div>
<div class="thumb" id="Othumb">
<a href="OrderUp.html">
<img src="OrderUpred.png" alt="screen mockups of OrderUp app">
</a>
<h3 id="Otitle">OrderUp - Food Delivery App</h3>
</div>
</div>
</div>
Try this.
Since the floated element widths exceed the total available width, the last element is pushed to the next line. Try using flex or grid. Please find the snippet usinggrid
.proj-box .wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 1em;
}
.proj-box .thumb {}
.proj-box img {
width: 380px;
border: 1px solid #ddd;
border-radius: 4px;
}
.proj-box img:hover {
box-shadow: 0 0 2px 1px #D89E9E;
}
<section class="proj-box">
<div class="wrapper">
<div class="thumb" id="Dthumb">
<a href="Dough.html">
<img src="Doughblack.png" alt="screen mockups of Dough app">
</a>
<h3 id="Dtitle">Dough - Your new financial companion</h3>
</div>
<div class="thumb" id="Fthumb">
<a href="Flyte.html">
<img src="flytebig.png" alt="screen mockups of Flyte app">
</a>
<h3 id="Ftitle">Flyte - Flight Search App</h3>
</div>
<div class="thumb" id="Othumb">
<a href="OrderUp.html">
<img src="OrderUpred.png" alt="screen mockups of OrderUp app">
</a>
<h3 id="Otitle">OrderUp - Food Delivery App</h3>
</div>
</div>
</section>
Related
For whatever reason I can't figure this simple thing out. I've 3 divs that I want to stack when shrinking the browser using flexbox, however I must be missing something. Any insight would be appreciated. I merely want to just make these responsive & have actually done this before but maybe I am going crazy :).
.container {
position: relative;
display: grid;
justify-content: center;
align-items: center;
flex-direction: row;
}
.item {
margin: 3px;
padding: 10px 0 0 10px;
display: grid;
flex-direction: row;
}
.item img {
max-width: 100%;
height: auto;
}
.description {
font-family: 'Nunito', sans-serif;
color: #000;
}
<div class="container">
<div class="item">
<a href="#">
<img width="400" height="400" src="https://placekitten.com/400/400" />
</a>
<div class="info">
Cheetah
</div>
<div class="description">
The cheetah is an atypical member of the cat family that is unique in its speed, while lacking climbing abilities.
</div>
<div>
Learn more
</div>
</div>
<div class="item">
<a href="#">
<img width="400" height="400" src="https://placekitten.com/400/400" />
</a>
<div class="info">
Cheetah
</div>
<div class="description">
The cheetah is an atypical member of the cat family that is unique in its speed, while lacking climbing abilities.
</div>
<div>
Learn more
</div>
</div>
<div class="item">
<a href="#">
<img width="400" height="400" src="https://placekitten.com/400/400" />
</a>
<div class="type">
Cheetah
</div>
<div class="description">
The cheetah is an atypical member of the cat family that is unique in its speed, while lacking climbing abilities.
</div>
<div>
Learn more
</div>
</div>
</div>
Use grid-template-columns: repeat(auto-fill, 150px); to have a CSS grid layout that automatically adapts to the viewport size without needing to hardcode #media rules.
For example:
.container {
display: grid;
grid-template-columns: repeat(auto-fill, 150px);
gap: 1em;
}
.item {
margin: 3px;
padding: 10px 0 0 10px;
display: flex;
flex-direction: column;
}
.item img {
max-width: 100%;
height: auto;
}
.description {
font-family: 'Nunito', sans-serif;
color: #000;
}
<div class="container">
<div class="item">
<a href="#">
<img width="400" height="400" src="https://placekitten.com/400/400" />
</a>
<div class="info">
Cheetah
</div>
<div class="description">
The cheetah is an atypical member of the cat family that is unique in its speed, while lacking climbing abilities.
</div>
<div>
Learn more
</div>
</div>
<div class="item">
<a href="#">
<img width="400" height="400" src="https://placekitten.com/400/400" />
</a>
<div class="info">
Cheetah
</div>
<div class="description">
The cheetah is an atypical member of the cat family that is unique in its speed, while lacking climbing abilities.
</div>
<div>
Learn more
</div>
</div>
<div class="item">
<a href="#">
<img width="400" height="400" src="https://placekitten.com/400/400" />
</a>
<div class="type">
Cheetah
</div>
<div class="description">
The cheetah is an atypical member of the cat family that is unique in its speed, while lacking climbing abilities.
</div>
<div>
Learn more
</div>
</div>
</div>
This is my first time on Stack Overflow. I recently started learning about HTML/CCS and I am stuck on a current project.
I wanted to make a gallery of album covers for a project, but whenever I 'zoom' in on the webpage (probably not the right term) the lay-out goes crazy. I think this issue is a 'responsive' issue and I tried adding a media query but i can 't make it look decently.
How can I change so that for example, it goes from a row of 5 album covers to 4 without there being gaps in the gallery? It goes from looking decent to 4 white squares in the same row.
I took the relevant code and pasted it in this link, if this isn't enough information I'd be happy to show all the code (it's still a bit of a mess, hence why I took this piece of code out of the full page)
https://codepen.io/LotteElders/pen/ZEpeRzN
div.gallery {
margin: 5px;
border: 1px solid #ccc;
float: left;
width: 180px;
}
div.gallery:hover {
border: 1px solid #777;
}
div.gallery img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
}
.responsive {
padding: 0 6px;
float: center;
width: 24.99999%;
}
#media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}
#media only screen and (max-width: 500px) {
.responsive {
width: 100%;
}
}
<figure>
<figcaption>
<h3> A summary of Cady Groves's albums </h3>
</figcaption>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/1oN2SgPwi43flviKj6rbBA">
<img src="https://m.media-amazon.com/images/I/714Jha+uaKL._SS500_.jpg" alt="Album cover of A Month of Sundays" width="600" height="400">
</a>
<div class="desc">A Month of Sundays (2009)</div>
</div>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/1vW2HVeeXpmGBbpLkzt375">
<img src="https://images.genius.com/0add2529149d47b12983fa2e4a07b2a6.300x300x1.jpg" alt="Album cover of The Life of a Pirate (2010)" width="600" height="400">
</a>
<div class="desc">The Life of a Pirate (2010)</div>
</div>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/6csTNqy5qkYCzPFJyHDA67">
<img src="https://m.media-amazon.com/images/I/71WUWQUq4-L._SS500_.jpg" alt="Album cover of This Little Girl" width="600" height="400">
</a>
<div class="desc">This Little Girl (2012)</div>
</div>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/5HYv3SmW85lbspRTA1rDY0">
<img src="https://img.discogs.com/vCdTJTKCznRPIgplZuMLAZeIoio=/fit-in/300x300/filters:strip_icc():format(jpeg):mode_rgb():quality(40)/discogs-images/R-14325893-1572275353-3944.jpeg.jpg" alt="Album cover of Dreams" width="600" height="400">
</a>
<div class="desc">Dreams (2015)</div>
</div>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/0k7vFx71y0w5r6RGhDMAfG">
<img src="https://images.genius.com/558fcb01fc43d257d8663b625cfa7086.1000x1000x1.jpg" alt="Album cover of Bless My Heart (2020)" width="600" height="400">
</a>
<div class="desc">Bless My Heart (2020)</div>
</div>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/7swc0NVH2XCLH1EAXnbsP3">
<img src="https://cont-5.p-cdn.us/images/public/int/9/3/2/2/886444042239_1080W_1080H.jpg" alt="Single cover of Forget You (2013)" width="600" height="400">
</a>
<div class="desc">Forget You (2013)</div>
</div>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/5jiaYe6RTZ5jpcqGbIVVyO">
<img src="https://resources.tidal.com/images/d4bbe9f2/bcdc/4489/81ef/42580782144b/640x640.jpg" alt="Album cover of This Little Girl" width="600" height="400">
</a>Whiskey & Wine feat. Christian Burghardt (2015) </div>
</div>
<div class="gallery">
<a target="_blank" href="https://open.spotify.com/album/6wUnijjeRKwBTqJSb7TcF4?highlight=spotify:track:3cXEhlI2PKHEjDt39I2upA">
<img src="https://images.genius.com/e45451e414fac83f6523a491f652a14a.500x500x1.jpg" alt="Single cover of Love Actually (2012)" width="600" height="400">
</a>
<div class="desc">Love Actually (2012)</div>
</div>
<div class="gallery">
<a target="_blank" href=https://open.spotify.com/album/0m2SFT766eRgMkzIjQHTOn?highlight=spotify:track:5eue4RoH3PG3k9qWdTwjL8>
<img src="https://images-na.ssl-images-amazon.com/images/I/91MNZnhU74L._SL1500_.jpg" alt="Single cover of Oh, Darling (2012)" width="600" height="400">
</a>
<div class="desc">Oh, Darling feat. Plug In Stereo (2012)</div>
</div>
</figure>
Thank you for reading this!
Please add the codes that I wrote.
figure {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
align-items: center;
justify-content: center;
}
I'm trying to get the images on both of divs below to act as a left-column while the accompanying text acts as a right column, both in the same row.
Each row should have the other images and texts along with it. Somewhere in the shuffle, I've got my divs mixed up and they aren't working properly. I need the text to stay within the container on the right. What am I missing?
.toplinks {
width: 300px;
padding: 20px;
overflow: hidden;
}
.icon {
width: 30%;
float: left;
}
.hlbox {
width: 300px;
border: 1px solid;
border-radius: 9px 9px 9px 9px;
border-color: #999999;
background-image: url(http://ejgh.org/templates/ejgh/images/HLHeader.png), url(http://ejgh.org/templates/ejgh/images/healthyLifestyles_bottom.gif);
background-size: 100% auto;
background-repeat: no-repeat;
background-position: top, bottom;
padding: 100px 20px 25px;
overflow: hidden;
}
.HLrow {
display: block;
border: 1px solid;
border-color: green;
width: 100%;
}
.HLicon {
width: 30%;
border: 1px solid;
border-color: red;
display: table-cell;
float: left;
height: inherit;
}
.HLtext {
width: inherit;
border: 1px solid;
border-color: purple;
}
<div class="toplinks">
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/findphysicianicon.jpg" alt="Find a Physician Icon" /></div>
<div class="text">
<h3>Find a Physician</h3>
<hr />Let us help you pick a doctor that fits your needs</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/paymybillicon.jpg" alt="Pay my Bill Icon" /></div>
<div class="text">
<h3>Pay My Bill</h3>
<hr />Conveniently pay your EJGH bill</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/myejghicon.jpg" alt="myEJGH.Org Icon" /></div>
<div class="text">
<h3>My EJGH.Org</h3>
<hr />See your up-to-date medical information</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/edocicon.jpg" alt="eDoc icon" width="75" /></div>
<div class="text">
<h3>eDoc</h3>
<hr />$49 Doctor visits via smartphone or online</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/mdportalicon.jpg" alt="" width="75" /></div>
<div class="text">
<h3>EJGH MD Portal</h3>
<hr />Physician login for portal access</div>
</div>
</div>
<p></p>
<!--Start HL Table-->
<div class="hlbox">
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_memberbutton.png" alt="Image of Apple and Weights for homepage" width="100%"/></div>
<div class="HLtext">
<h3>Become a Member</h3>
<hr />
<p>Join Healthy Lifestyles and enjoy the benefits of membership.</p>
</div>
</div>
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_communitybutton.png" alt="Image of elderly couple at hospital in New Orleans Louisiana" width="100%" /></div>
<div class="HLtext">
<h3>Community Events</h3>
<hr />
<p>Learn more about the classes, events, support groups, and health screenings we offer.</p>
</div>
</div>
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_tvbutton.png" alt="Image of Liz Delsa Healthy Lifestyles Host" width="100%" /></div>
<div class="HLtext">
<h3>Watch TV Segments</h3>
<hr />
<p>Watch Healthy Lifestyles TV segments as seen on WWL-TV.</p>
</div>
</div>
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_magbutton.png" alt="Summer 2016 Healthy Lifestyles Cover" width="100%" /></div>
<div class="HLtext">
<h3>Read the Magazine</h3>
<hr />
<p>Read the latest Healthy Lifestyles Magazine as included in the Times-Picayune newspaper.</p>
</div>
<!--End HL Table-->
</div></div>
<!--End Box Div—>
Also, the boxes around the HLdiv can go away - I just was using those to try to get an eye for what's pulling where.
Thanks again.
If I understood correctly, all you have to do is add display: table-cell; to the HLtextclass.
I have 3 icons that i want to align them in the center i tried different code but nothing is working so far, i tried putting a margin right to it, but the problem with that is that it's adding an unnecessary space between them, so i want them to be close to each other, is there a way to put margin-right to it and remove the space from there ?
i just want to align them below my paragraph but in the center of it.
heres my code so far.
#body a img {
width: 50px;
height: 50px;
margin-top: 50px;
margin-right: 200px;
}
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias</p>
<div class="icons">
<a href="https://www.youtube.com/themunkiuke">
<img class="icon1" src="images/youtube.png">
</a>
<a href="http://www.twitch.tv/siminios">
<img class="icon2" src="images/twitch.png">
</a>
<a href="http://yinochi.deviantart.com/gallery/">
<img class="icon3" src="images/art.png">
</a>
</div>
Will it be a simple text-align missing ?
#body a img {
width: 50px;
height: 50px;
}
.icons {
text-align:center;
}
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias</p>
<div class="icons">
<a href="https://www.youtube.com/themunkiuke">
<img class="icon1" src="images/youtube.png">
</a>
<a href="http://www.twitch.tv/siminios">
<img class="icon2" src="images/twitch.png">
</a>
<a href="http://yinochi.deviantart.com/gallery/">
<img class="icon3" src="images/art.png">
</a>
</div>
Here you are DEMO
#body a img {
width: 50px;
height: 50px;
}
.icons {
text-align: center;
}
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias</p>
<div class="icons">
<a href="https://www.youtube.com/themunkiuke">
<img class="icon1" src="images/youtube.png">
</a>
<a href="http://www.twitch.tv/siminios">
<img class="icon2" src="images/twitch.png">
</a>
<a href="http://yinochi.deviantart.com/gallery/">
<img class="icon3" src="images/art.png">
</a>
</div>
Here's a demo https://jsfiddle.net/r4wwczao/
In HTML I added a container for each icon to give them a percent size (the border is just to see the solution better):
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias </p>
<div class="icons">
<div class="icon_div">
<img class="icon1" src="images/youtube.png">
</div>
<div class="icon_div">
<img class="icon2" src="images/twitch.png">
</div>
<div class="icon_div">
<img class="icon3" src="images/art.png">
</div>
</div>
</div>
And CSS:
img{
width: 50px;
height: 50px;
}
.icon_div{
border:1px black solid;
display: inline-block;
text-align: center;
width:32%;
}
Newbie here.
I am trying to create a page of 12 equal-sized images in a 3 Column * 4 Row layout.
I am having a problem with unwanted space appearing between each row. I am currently using <br>, which I know is incorrect, but I don't know the correct way to do it. As I understand it, tables are now considered a poor method?
I currently have CSS :
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
body {
background: black;
}
.centerDiv {
width: 60%;
height:200px;
margin: 0 auto;
background-color:#FFA500;
}
.pic {
border-left: 0px solid black;
border-right: 0px solid black;
float: left;
/* height: 300px; */
/* width: 300px; */
margin: 0px;
overflow: hidden;
-webkit-box-shadow: 0px 0px 0px #111;
box-shadow: 0px 0px 0px #111;
}
And my HTML :
<html>
<head>
<meta charset=utf-8 />
<meta name="description" content="description">
<title>JimithyH</title>
<link rel="stylesheet" type="text/css" media="screen" href="styles.css" />
</head>
<body>
<div class="tilt pic">
<div class="imgContain">
<img src="tree-0-0.jpg" alt="">
</div>
</div>
<div class="tilt pic">
<img src="tree-0-1.jpg" alt="">
</div>
<div class="tilt pic">
<img src="tree-0-2.jpg" alt="">
</div>
<br clear="all">
<div class="tilt pic">
<img src="tree-1-0.jpg" alt="">
</div>
<div class="tilt pic">
<img src="tree-1-1.jpg" alt="">
</div>
<div class="tilt pic">
<img src="tree-1-2.jpg" alt="">
</div>
<br/ clear="all">
<div class="tilt pic">
<img src="tree-2-0.jpg" alt="">
</div>
<div class="tilt pic">
<img src="tree-2-1.jpg" alt="">
</div>
<div class="tilt pic">
<img src="tree-2-2.jpg" alt="">
</div>
<br clear="all">
<div class="tilt pic">
<img src="tree-3-0.jpg" alt="">
</div>
<div class="tilt pic">
<img src="tree-3-1.jpg" alt="">
</div>
<div class="tilt pic">
<img src="tree-3-2.jpg" alt="">
</div>
</body>
</html>
So it looks like the comments beat me to it but all you need is to set the width of an image to 33.333%, that way the browser will automatically start a newline when it runs out of space. Personally i'd like to have some padding around the image so my CSS for an image like yours would be:
img {
width: 30%;
padding: 1%;
}
Seems you are missing to define the width of the tag that encloses the tag.
You need to split the body width 100% for every three and so each should have 33% (just round off).
so you can mention in css as
#tilt pic
{
width : 33%;
margin-left : 2px; // as per your requirement
}
This will surely works for you.