Jump to content

HTML Help - Featuring text below images.

Scribbles4321

Hello!

I'm fairly new to HTML. Here is a screenshot of my website below, where these 5 pictures will always line up next to each other

image.thumb.png.3da3dacaab5300b41ba696e4e61e66ab.png

 

What I want, is for text to directly appear under each one of these 5 pictures without breaking the arrangement of these 5 pictures. I've been trying to do this for the longest time, but the website seems to keep breaking.

 

I want the text to stay under each picture despite the resizing of the window that the page is displayed in.

 

For those who want to review this, the HTML file is located in the zip and the CSS starts at line 41 (css is in the html file) and the section of HTML tat corresponds to the picture in the screenshot is in line 194. Thank you

 

 

src.zip

Link to comment
Share on other sites

Link to post
Share on other sites

If you'd like me to submit any section of my code, please do ask. Thank you

Link to comment
Share on other sites

Link to post
Share on other sites

Wrap the item images in another containing div, so each store item has both an image and a text-container elements 

<div class="image-section">

    ...

      <div class="item-container">
        <img src="images/newarrivals/bestsellers_1.png">
        <div class="text-container">
          <div class="shoe-name">Shoe Name 1</div>
          <div class="price">from $100</div>
        </div>
      </div>
      
     ...
     
</div>

You repeat the code between the ... for however many items for each per row.

 

CSS for .item-container will be

        .image-section .item-container {
            margin: 5px;
            max-width: calc(20% - 10px); /* 20% width for each image with 10px margin */
            height: auto;
            float: left;
        }

 

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, C2dan88 said:

Wrap the item images in another containing div, so each store item has both an image and a text-container elements 

<div class="image-section">

    ...

      <div class="item-container">
        <img src="images/newarrivals/bestsellers_1.png">
        <div class="text-container">
          <div class="shoe-name">Shoe Name 1</div>
          <div class="price">from $100</div>
        </div>
      </div>
      
     ...
     
</div>

You repeat the code between the ... for however many items for each per row.

 

CSS for .item-container will be

        .image-section .item-container {
            margin: 5px;
            max-width: calc(20% - 10px); /* 20% width for each image with 10px margin */
            height: auto;
            float: left;
        }

 

I tried this, it seems to break the sizing of my images

image.png.f36f24a94d9d4240d62acd29b4246f1c.png

 

I may be doing something wrong here? 💔

Link to comment
Share on other sites

Link to post
Share on other sites

18 hours ago, Scribbles4321 said:

I tried this, it seems to break the sizing of my images

image.png.f36f24a94d9d4240d62acd29b4246f1c.png

 

I may be doing something wrong here? 💔

@Scribbles4321Check your .image-section img selector.  I changed your width from a calc to 100%.  With @C2dan88's markup, the images are now contained in a separate div that has its own height and width, so it will control how they display:
image.thumb.png.439f218bfe743afbd60cd1b539e80a17.png

Link to comment
Share on other sites

Link to post
Share on other sites

hey, please finish a tutorial on flex box. it makes things like this very easy. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Vicarian said:

@Scribbles4321Check your .image-section img selector.  I changed your width from a calc to 100%.  With @C2dan88's markup, the images are now contained in a separate div that has its own height and width, so it will control how they display:
image.thumb.png.439f218bfe743afbd60cd1b539e80a17.png

Oh yes, I got it to work now. Thank you so much for your help

 

@C2dan88 Thank you so much for helping me, I wouldn't have had this working without you 😄

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×