Lambneck Posted October 16, 2008 Share Posted October 16, 2008 Hello, I am having trouble properly aligning the contents of this list: html: <ul id="navbar"> <li id="recruitTeacher"><a href="recruitTeacher.php">Recruit Teacher</a></li> <li id="postResume"><a href="postResume.php">Post Resume</a></li> <li id="viewJobs"><a href="viewJobs.php">View Jobs</a></li> <li id="viewResumes"><a href="chatRoom.php">View Resumes</a></li> <li id="forum"><a href="forums.php">Forum</a></li> <li id="help"><a href="help.php">Help</a></li> </ul> CSS: #navbar{ height:44px; margin:0; padding:0; background-image: url(../pix/perpetualGradient.jpg); background-repeat: repeat-x; } #recruitTeacher, #postResume, #viewJobs, #viewResumes, #forum, #help { padding-top: 14px; margin-left: 82px; border-left: none; display: inline; font-size:14px } The content of the list is displayed totally aligned to the top of the "navbar" area. What I am trying to do is get it centered in that area. As you can see I tried pushing it down with {padding-top: 14px;} but it didn't affect the content at all and I don't know why. Quote Link to comment https://forums.phpfreaks.com/topic/128677-solved-padding-margin-alignment/ Share on other sites More sharing options...
svivian Posted October 16, 2008 Share Posted October 16, 2008 Easiest solution is to put line-height:44px; in the #navbar rules. (Using inline-block and vertical-align for the list items is probably the best solution, but some browsers do not support it properly yet). Also, your second set of rules (#recruitTeacher, #postResume...) can be abbreviated to #navbar li if you want it to apply to all the list items inside the ul. Then you don't need the id attributes (unless you're using them for something else, eg a drop down menu). Quote Link to comment https://forums.phpfreaks.com/topic/128677-solved-padding-margin-alignment/#findComment-667533 Share on other sites More sharing options...
Lambneck Posted October 17, 2008 Author Share Posted October 17, 2008 hey thanks svivian, line-height did the trick! Quote Link to comment https://forums.phpfreaks.com/topic/128677-solved-padding-margin-alignment/#findComment-667634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.