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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:36:26+00:00 2026-05-12T15:36:26+00:00

I know this is a common question but I just can’t seem to get

  • 0

I know this is a common question but I just can’t seem to get it right. I have tried everything except the one thing that will make this work, including various placements and combinations of clear and overflow settings. Here’s my code (stripped down for posting)

<style>

#message      { border:thin red dashed; overflow:hidden; }
#message p     { border:thin red solid; }
#line1      {   border:thin blue solid; }
#text        { text-align:center; background-color:#FCF; vertical-align:middle;}
#photo      {  float:left; width:160px; border:thick black solid;}

</style>
</head>

<body>
<div id="Main"> 
        <div id="line1">            
            <div id="message" >                     
                <div id="photo" >       <!-- floated pic box  -->
                    Pretend a picture is here. Pretend a picture is here.
                    Pretend a picture is here. Pretend a picture is here.
                </div> <!-- photo -->

                <div id="text"> Click here to see all Key West Tours, Attractions and Packages<br />
                    Buy Online and Save!
                </div> <!-- text -->

            </div> <!-- message -->
        </div> <!-- line1 -->
</div> <!-- Main -->

I want the text to be aligned middle and realize it’s because the actual text div (pink box) can align middle all day long and as long as it stays that height it won’t change.

Question: How do I get my text div to grow to the height of the faux picture box so I can align it to the middle of that section?

  • 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-12T15:36:27+00:00Added an answer on May 12, 2026 at 3:36 pm

    There isn’t really a good way of going about what you are trying to do. Since you have your image in its own div floated to the left it is hard to get your text div to align with it.

    I would just give the text div some top margin so that it atleast starts somewhere near the middle of the image, but obviously that is not a specific solution, its more of another option.

    If you absolutely need to have it centered one of these links could help,

    phrogz.net/CSS/vertical-align/index.html

    or

    webtoolkit.info/css-vertical-align.html

    Alternatively you could try putting the image and the text together in a single div tag and give the image vertical align: middle, as long as there are no line breaks that would align the text to the middle of the image.

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

Sidebar

Related Questions

I know this isn't strictly a programming question but y'all must have experienced this.
Okay, I know this is a common enough question, but all the solutions I've
I know this is probably a common and easily answered question, but I'm a
I know this is a common convention, but what does the k in variable
I know this is a common error, but bear with me. I've pursued the
I know this is a broad question, but I've inherited several poor performers and
UPDATE 10/19/2010 I know I asked this question a while ago, but the workarounds
This is probably a common Objective-C question reported by Java coders, but I don't
This isn't exactly a programming question exactly. I just want to know what your
I have a question about this question . I posted a reply there but

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.