Jump to content

Middling the title


terryds

Recommended Posts

Sorry for my bad English skill ...

 

I mean, in http://terryds.net63.net/ , then i inspect the elements , then i change the #page_header to 200px ...

 

So, the #page_header height becomes 200px , but the #title doesn't automatically moved to the middle of the page header ...

 

 

Can you tell me how to make the #title get to the middle of page header automatically even if the page header's height changes ?

Link to comment
Share on other sites

By "middle" I guess you mean vertical centering? I don't know how to do it automatically when you have float involved. You need one of the css gurus to answer that. All I can offer is a manual adjustment...

#title {	text-align: center;	line-height: 150px;	/*vertical-align: middle;*/}
Edited by davej
  • Like 1
Link to comment
Share on other sites

I agree with dsonesuk. If you make the #page_nav display: table-row and give it a height of 0 and a width of 100%, and than the #title display: table-cell. It works fine.

 

Personally I think you could improve on the code using these suggestions so play around. :D

  • Like 1
Link to comment
Share on other sites

Yeah, i have opened that link.... But, i still wonder why i should make it display as table...

 

In http://www.w3schools.com/cssref/pr_pos_vertical-align.asp , it says when the vertical-align:middle, it will make it placed in the middle of parent element.

 

But, if i just use vertical-align : middle without displaying it as a table, it doesn't work...

 

 

Can you tell me why i should use display:table ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...