March 26, 201016 yr Hey, I'm trying to center links horizontally in a div, I know this mustn't be too complicated... This is the code: <div id="HeaderRightCol"> <img src="imagesnew/greenpanel.gif" alt="" width="250" height="50" /> <div id="HeaderLink"><a class="HeaderLinks" href="<?php echo $currentPage ?>?ID=5&type=Home">FULL TIME COURSES</a><br /></div> <div id="HeaderLink"><a class="HeaderLinks" href="<?php echo $currentPage ?>?ID=33">PART TIME COURSES</a><br /></div> <div id="HeaderLink"><a class="HeaderLinks" href="<?php echo $currentPage ?>?ID=34">IT COURSES</a><br /></div> </div> and this is the CSS: #HeaderLink { width: 250px; height: 46px; border-bottom: 1px dotted #a1ae00; } I've tried 'text-align: center;' but this give vertical alignment. I could work around it with padding but is there a better way? cheers
March 26, 201016 yr Why have you put your <a> links in <div>s? This really in unnecessary bloat of code. Strip them out - besides they all have the same ID, and you should only have one ID of the same name and tag per page. Once you've stripped out the divs, use this CSS #HeaderRightCol a {text-align:center;}
March 26, 201016 yr Author Why have you put your <a> links in <div>s? This really in unnecessary bloat of code. Strip them out - besides they all have the same ID, and you should only have one ID of the same name and tag per page. Once you've stripped out the divs, use this CSS #HeaderRightCol a {text-align:center;} Hey notbanksy, how do I space my links if theyre not in divs? I want them to look like the attached screen grab, I'll try that CSS too, cheers for that
Create an account or sign in to comment