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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:28:04+00:00 2026-06-13T06:28:04+00:00

I have this html: <div id=main> //contents </div> and this css: #main { padding:10px;

  • 0

I have this html:

<div id="main">
   //contents
</div>

and this css:

#main {
   padding:10px;
   margin-top:5px;
   display:table-cell;
   font-family:Calibri;
   font-size:25px;
   background-color:#50aafb;
}

and i have javascript that calculates how much to move the main div to left/margin-left. The div isn’t moving because of the display:table-cell but i need that for something else…

How do i resolve this?

UPDATE: http://jsfiddle.net/yueCM/

UPDATE 2:
Javascript:

$(window).load(function() {
   var l = ( $(document).width() - $('#main').width() ) / 2;
   $('#main').animate({marginLeft:l}, 200); 
});

SOLUTION (for me):
changed table-cell to table.

SOLUTION (found by @Sparky672):
https://stackoverflow.com/a/2986792/594235

Wrap the table-cell div in another div (with block display for example) and apply the JS to that div.

  • 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-13T06:28:05+00:00Added an answer on June 13, 2026 at 6:28 am

    Use inline-block instead of table-cell : demo

    #main is just the wrapper, it won’t hurt. Browser support is similar: inline-block , table-cell.

    For IE<8 support, add:

    *zoom: 1;
    *display: inline;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this div: main.css(external) : #content{ padding:35px; } Then I php include another
In the below shown html i have this main div as cxfeeditem feeditem and
I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{
I have this HTML code: <div id=main> <div id=dv_7>...</div> <div id=dv_1>...</div> <div id=dv_8>...</div> <div
I have this html <div id=cont> <div id=videowrapper class=fitmein> <div id=vimeoposition style=display: block;> <div
I have a div main that has a table grid . This table has
This is a pure html/css Question, here it goes.. I have a floating div
I have this: HTML: <div id=selectedsongs> <a href=# rel=1>song1></a> <a href=# rel=2>song2></a> <a href=#
I have this HTML structure <div class=buttons> <button data-icon=ui-icon-disk class=save>Save1</button> <button data-icon=ui-icon-check class=ok>OK1</button> <button
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>

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.