Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:55:59+00:00 2026-06-17T06:55:59+00:00

I am trying to make a simple page: two centered thumbnails images. Each one

  • 0

I am trying to make a simple page: two centered thumbnails images. Each one links to its original image. Here is the code (I’ve removed some part for clarity):


<!DOCTYPE html>
<html>
  <head>
    <style>
      .column1, .column2 {
      width:50%;
      float:left;
      }

      div img {
      display:block;
      margin:20px auto;
      width:300px;
      }
    </style>
  </head>
  <body>
    <div class="column1">
      <a href="#">
        <img src="maelstrom_mini.jpg" />
      </a>
    </div>
    <div class="column2">
      <a href="#">
        <img src="maelstrom_mini.jpg" />
      </a>
    </div>
  </body>
</html>


The issue is that very subtle: Each image is only 300px wide, but the anchor boxes are wider that the image it is supposed to contain. It makes the image “clickable” above its surface. I can’t figure out how to tell the anchor not to spread to all its column.

When I remove the display:block attribute in the style sheet, then it solves that issue, but my pictures are no longer centered in regards to the containing column.

What’s the correct solution to have both correct presentation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:56:00+00:00Added an answer on June 17, 2026 at 6:56 am

    I’ve fixed your problem,

    I’ve added a wrapping div around the a and img tag setting that width to 300px, then setting the images width to 100% like so,

    <!DOCTYPE html>
    <html>
      <head>
        <style>
          .column1, .column2 {
          width:49%;
          float:left;
          border: 1px solid red;
          }
    
          div img {
          width:100%;
          }
    
          #img-wrap{
    
          width:300px;
           margin:20px auto;
          display: block;
          }
    
    
        </style>
      </head>
      <body>
        <div class="column1">
          <div id="img-wrap">
          <a href="#">
            <img src="" />
          </a>
          </div>
        </div>
        <div class="column2">
          <div id="img-wrap">
          <a href="#">
            <img src="" />
          </a>
            </div>
        </div>
      </body>
    </html>
    

    which can be found to work here > http://jsfiddle.net/3se2V/3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make something simple in JS. Lets say I have two images, I
I am trying to make a simple html page that takes info from two
I'm new to php and am trying to make a very simple two page
I've been trying to make a simple search inside a static HTML page using
Trying to make simple minesweeper game in python, but have one problem. I have
I'm trying to make simple website with content background combined from 3 images: top
I'm trying to make a gallery with highslide. I have two thumbnails, a larger
I am trying to make a simple page where there will be a Highstock
I'm trying to make a simple script that does two things: Serves up a
So I have been trying to make a simple page with simple dropshadows. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.