Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
James Wrest
3,480 PointsHeading to align in the center of page
Hi
I'm trying to get the img, text and number to line up in the center of the header?
http://www.vestedutility.com.au/electrical_work_perth.php
not sure if there is a easy way to do this or am i doing something worng?
3 Answers
Manuel Quintanilla
3,083 PointsThis should help work:
header { float: left; margin: 0 0 30px 0; padding: 10px 0 0 0; <-- added 10px to the to of the header --> width: 100%; background-color: lightgrey; position: fixed; top: 0; }
logo {
max-height: 25%; margin: 0; position: absolute; top: 8; transform: translate(0, -50%); }
nav li { display: inline-block; margin: 0; position: absolute; top: 50%; left: 30%; transform: translate(0, -50%); }
.office-number { font-size: 135%; font-weight: bolder; color: #CC9933; margin: 0; position: absolute; top: 50%; right: 60; transform: translate(0, -50%); }
Radu Ioan Stochita
3,558 PointsWhat about vertical-align property?
James Wrest
3,480 Pointsnah it didn't do anything the above code worked
Manuel Quintanilla
3,083 PointsWhen ever you run into a problem like this you can inspect the element with the dev tools and edit in realtime then add changes to your web page :)
James Wrest
3,480 PointsJames Wrest
3,480 Pointsyea that worked thanks, the css can be tricky to get it to do what your after!