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 53989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:08:59+00:00 2026-05-10T17:08:59+00:00

This might be a stupid question but if there’s a better or proper way

  • 0

This might be a stupid question but if there’s a better or proper way to do this, I’d love to learn it.

I have run across this a few times, including recently, where small spaces show up in the rendered version of my HTML page. Intuitively I think these should not be there because outside of text or entities the formatting of a page’s HTML shouldn’t matter but apparently it does.

What I’m referring to is this – I have some Photoshop file from the client on how they want their site to look. They want it to look basically pixel perfect to the image in this file.

One of the places in the page calls for a menu bar, where each one does the changing bit on hovering, acts like a hyperlink, etc. In the Photoshop file this is one long bar, so a cheap and easy way to do this is to just split that segment into multiple images and then place them next to each other in the file.

So instinctively I lay it out like so (there’s more to it but this is the gist)

<a href='page1.html'>   <img src='image1.png' /> </a> <a href='page2.html'>   <img src='image2.png' /> </a> <a href='page3.html'>   <img src='image3.png' /> </a> 

and so forth.

The problem is the images have this tiny space between them which is unacceptable since the client wants this thing pixel-perfect (and it just plain looks bad).

One way to get it to render properly is to remove the carriage returns between the images

<a href='page1.html'>   <img src='image1.png' /> </a> <a href='page2.html'>   <img src='image2.png' /> </a> <a href='page3.html'>   <img src='image3.png' /> </a> 

Which makes the images go right up against each other (the desired effect) but it makes the line incredibly long and the code more difficult to maintain (it wraps here in SO and this is a simplified version – the real one has longer filenames and JavaScript sprinkled in to do the hovering).

It seems to me that this shouldn’t happen but it looks like the carriage return in the HTML is being rendered as a small empty space. And this happens in all browsers, looks like.

Am I right or wrong for thinking the two snippets above should render the same? And is there something I’m doing wrong? Maybe saving the file with the wrong encoding? Should I make every one of these links a perfectly positioned CSS element instead?

  • 1 1 Answer
  • 5 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. 2026-05-10T17:08:59+00:00Added an answer on May 10, 2026 at 5:08 pm

    The whitespace (carriage return included) is usually rendered as space in all browsers.

    You need to put the elements one after another, but you can use a trick:

    <a href='page1.html'><img src='image1.png'  /></a><a href='page2.html'><img src='image2.png'  /></a><a href='page3.html'><img src='image3.png'  /></a> 

    This also looks a little ugly, but it’s still better than one single line. You might change the formatting, but the idea is to add carriage returns inside the elements and not between them.

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

Sidebar

Related Questions

This might sound like a stupid question but just trying to learn something here.
This might be a very stupid question, but I have to ask it anyway.
This might be a stupid question, but is there a rule that states that
This might be a stupid question, but is there any common practice for initializing
This might sound like a stupid question, but google didn't help me. Is there
This might be a stupid question, but i'm stuck doing it :(. I have
This might seem like a stupid question but I have always wondered. What would
This might be a stupid question but I'm new at all this. I want
This might be a stupid question but I'll ask anyway, I was reading OOP
This might be a stupid question, but I was wondering whether or not you

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.