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

  • Home
  • SEARCH
  • 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 8229447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:47:49+00:00 2026-06-07T16:47:49+00:00

This is an excerpt from my code: <div id=column2> <div id=textbox> <h3>About</h3> <div id=text>

  • 0

This is an excerpt from my code:

<div id="column2">
  <div id="textbox">
    <h3>About</h3>
    <div id="text">
      <img id="portrait" src="images/portrait.png"/>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sollicitudin tristique posuere. Phasellus quis rhoncus felis. </p>
      <p>Curabitur condimentum gravida lorem, non accumsan justo facilisis non. Nam at nisi venenatis tortor viverra posuere.</p>
    </div>
  </div>
</div>

CSS code for that excerpt:

#textbox {
    background:lightgrey;
    margin:38px 0 0 0;
    width:400px;
    font-size:0.825em;
    line-height:150%;
}

#textbox p {
    margin-top:0;
}

#textbox h3 {
    margin: 0 0 15px 0;
}

#column2 {
    float:right;
    margin-right:150px;
}

#portrait {
    float:right;
    margin:0 0 10px 10px;
}

What is wrong is that when I don’t have an image in “textbox” div, the center is different than the center with an image. I am using margin: 0 auto; to center whole wrapper div that is not included here.
I would probably be able to center it properly with absolute positioning (didn’t test it yet), but why the image affects the center? The whole wrapper div goes about 5-10px to the right, because of the image (I tested it). Any suggestions? Thank you very much.

Fiddle:
http://jsfiddle.net/uVSTJ/1/

Edit: if i’m not using any center positioning, no problem occurs.

Edit 2: I found the problem, but don’t know how to solve it. It only happens when I reach the bottom of a page, and a scrollbar appears. I suppose it starts calculating margins or something from a different place, what results in + several pixels to the right. Any way to solve this without using overflow property?

  • 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-07T16:47:50+00:00Added an answer on June 7, 2026 at 4:47 pm

    5 to 10px reminds me of a scrollbar. Maybe the image causes the heigth of the web page to exceed the height of the window in which case a scrollbar will be added. This causes the content to move a little bit.

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

Sidebar

Related Questions

Here is an excerpt from the html I want to scan through. <div class=text>
I have the following HTML (excerpt from larger code-base) <div class=diary-event ui-corner-all title=[title]> <span
Greetings! I must be seeing things. Look at this excerpt from the iPhone OS
This is an excerpt of some c++ code, that i'll have to explain in
I have explained the problem below this code <div id='content'> <div id='help'> blah blah
From below HTML code I want to get all the text except that in
here is my custom code this will list all page from specific parent but
Here is a code excerpt from a dhtmlxgrid sample file: <p> You are allowed
I have this HTML structure (excerpt): <td> <select id=test1 class=pub_chooser> <option value=99>All Publications</option> <option
I read this question in stackoverflow. The excerpt answer provided by bbum is below:

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.