Click here to Skip to main content
16,022,060 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<head>
   <meta charset="UTF-8" />
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <link rel="stylesheet" href="style.css" />
   <title>Shoe Store</title>
 </head>
 <body>
   <section class="container">
     <h1>Converse Chuck Taylor</h1>
     <div class="grid">
       <div class="product-img">
         <img src="/shoe.jpeg" alt="shoe" />
       </div>

       <div class="product-info">
         <p class="price">$65.00</p>
       </div>

       <div class="product-details">
         <p class="product-detail-text">Product Details</p>
       </div>
     </div>
   </section>
 </body>



CSS
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
}

section {
  max-width: 1200px;
}

.container {
  margin: 50px auto;

  border: 2px solid black;
}

h1 {
  text-transform: uppercase;
  text-align: center;
  padding: 20px 0;
  background-color: #888;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

img {
  width: 100%;
}


What I have tried:

I am not sure if the image will appear but I just want to ask, why is there a small gap in the bottom of the image and the border? Is there a way to remove the gap and make the image and border flush? Sorry for my bad english.

This is the image link Imgur: The magic of the Internet[^]
Posted

1 solution

When I am diagnosing issues like this, I lean heavily into using the browser debug tools. Press F12 to bring the window up, and choose the style section. There's a widget that let's you pick an element. Use that to choose your image and then view what the browser is doing. Try playing around with the CSS in the browser and see what effect it has, e.g., set the img height to 100%.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900