Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Centre a div

Centre a div

Centre a div

Hi ya

I know this is a really silly question but I have a div inside a div tag that holds a countdown clock I am trying to centre the div inside the div.


The container div is call is "countdownclock inside that div is a div called "daysBox".

I am trying to centre the "daysBox" inside the "ountdownclock" so it is centred to the left.

#countdownclock {
padding: 5px;
height: 56px;
width: 980px;
margin-right: auto;
margin-left: auto;
margin-top: auto;
border-width: 2px;
border-style: solid;
#daysBox {
height: 42px;
width: 105px;
margin-right: auto;
margin-left: auto;
border-width: 1px;
border-style: solid;
font-size: 44px;

Thanks Joel

RE: Centre a div


centred to the left

anyway, here is an example of vertically and horizontally centred nesting divs

RE: Centre a div

Thank you, how do you make it left align?

RE: Centre a div

Define 'it'

RE: Centre a div

1. How is this Javascript related?

This is just CSS. forum215: HTML, XHTML & CSS

2. Creating new threads instead of answering the questions in the previous ones you've made, makes it hard to follow.

3. Technically the CSS you have there should center the daysbox div inside the countdownclock div which itself is also centered inside its container. Unless you have other CSS being applied, or your ID's do not match correctly.

Phil AKA Vacunita
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close