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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:02:47+00:00 2026-05-29T06:02:47+00:00

I’ll preface this question by stating I have historically used tables for my HTML

  • 0

I’ll preface this question by stating I have historically used tables for my HTML formatting and am fairly good at getting it to look the way I’d like… I am aware that tables are meant for “tabular data” and not formatting. I always get a bit frustrated when I try to do it the “right way”, so today I am seeking some help.

<div style="width: 90%;">

  <div style="width: 50%; height: 75px; vertical-align: middle; float: left;">
    <a href="a.html" style="margin: auto 0px auto 0px">
      <img src="../../images/red_arrow_50.png" alt="a" width="50" height="50" style="border-width: 0px;" />
    </a>
    <a href="a.html" style="margin: auto 0px auto 0px;">A Link</a>                        
  </div>

  <div style="width: 50%; float: right;">
    <a href="b.html">B Link</a>                        
  </div>

</div>

As you can see from my attempts above, I’d like for the image link and the 2 text links to all line up along the same horizontal line (i.e. text links at the center of the image). Depending on how wide the parent div is I’d like the A img/link and B link a reasonable distance from one another. I’d also like for the divs with the “float: left” and “float: right” styles to not extend south beyond the border of the parent div (for some reason it is doing that to me in firefox with the above code).

Please help set me straight? Am I the only one who finds “the right way” of formatting things to be a big pain in the rear? I’m hoping I’m missing something big that if corrected will get me going down the right path.

===============

Update, thanks for the comments, I went to jsfiddle and fiddled a table-based solution:

   <table style="width: 90%; margin: 0px auto 0px auto;">
        <tr>
            <td style="width: 50%;"><a href="a.htm"><img src="http://www.chemfindit.com/img/search_icon.jpg" alt="A" width="50" height="50" style="border-width: 0px; vertical-align: middle;" /></a><a href="a.htm" style="margin: auto 0px auto 0px; vertical-align: middle;" >A-Link</a></td>
            <td style=""><a href="b.htm"><img src="http://www.chemfindit.com/img/search_icon.jpg" alt="B" width="50" height="50" style="border-width: 0px; vertical-align:middle;" /></a><a href="b.htm" style="margin: auto 0px auto 0px; vertical-align: middle;" >B-Link</a></td>
        </tr>
    </table>

Yields the desired layout:

Desired Layout

I think it must be my misunderstanding/usage of floats and positions that always stings me when I try div-based layouts.

  • 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-05-29T06:02:47+00:00Added an answer on May 29, 2026 at 6:02 am

    Personally I’d do it like this – http://jsfiddle.net/spacebeers/nWNPm/7/

    .magLink {
            list-style: none; 
            height: 50px;
            float: left;
            margin: 0 50px 0 0;
    }
    
    .magLink li {
            float: left;
            height: 50px;
            display: table;
    }
    
    .magLink li a {
            height: 50px;
            display: table-cell;
            vertical-align: middle;
    }
    
    
    <ul class="magLink">
        <li><a href="#"><img src="http://www.whg.uk.com/Image/Magnifying_glass_1.gif" width="50" height="50" /></a></li>
        <li><a href="#">Link A</a></li>
    </ul>
    

    You can just copy the <ul> to have more than one. Just adjust the right margin to space them out how ever you want. I’ve set up examples of single link, multiple links and links with extra styling for in in the JSFIddle.

    EDIT:

    JSFiddle’s running pretty badly so here’s an image of the output in case it’s not working.

    enter image description here

    Vertical alignment can be a real pain in CSS but tables for layout have had their day man. Let them live out their days being used for tabular data in peace.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

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.