Rob in hood Posted July 5, 2009 Report Posted July 5, 2009 I want to make the text of a link bigger when the mouse hovers over it, but when I add a font-weight: bold; or font-size: 120%; then it makes all the text next to and above it jump around. Any way to fix this? Quote
Andrea Posted July 5, 2009 Report Posted July 5, 2009 I haven't tried or researched it, but of the top of my head, try adding padding or border to your regular link and none to the one with the bigger font - you'll just have to play with how may pixel until things quit jumping. Seems like it should work..... Quote
Rob in hood Posted July 5, 2009 Author Report Posted July 5, 2009 Ok, that's what I had hoped I wouldn't have to do So fiddly and it'll break if a different font is used. I think I'll stick to just underlining and changing the colour. Thanks! Quote
PicnicTutorials Posted July 6, 2009 Report Posted July 6, 2009 (edited) You would do this... You would need to wrap each anchor in a container (probably an li), and give the anchors container a fixed width and text-align center. That's it! That will keep it from affecting anything else around it. Edited July 6, 2009 by Eric Quote
Rob in hood Posted July 6, 2009 Author Report Posted July 6, 2009 (edited) item 1 item 2 item 3 Edited July 6, 2009 by Rob in hood Quote
Wickham Posted July 6, 2009 Report Posted July 6, 2009 (edited) Inline elements like li don't have a width, so people often convert them to block; but then they will follow the rules for a block element so you may have other adjustments to make, like using float: left; instead of display: inline. li { display: block; float: left; width: ??px; } Edited July 6, 2009 by Wickham Quote
PicnicTutorials Posted July 6, 2009 Report Posted July 6, 2009 Like this... > { visibility: inherit; } Testing <br /><!--<br />li {<br />float:left;<br />width:100px;<br />text-align:center;<br />}<br />a:hover{<br />font-size:120%;<br />}<br />--><br /> </pre> <ul> item 1 item 2 item 3 </ul> <br><br Quote
Rob in hood Posted July 6, 2009 Author Report Posted July 6, 2009 Great! Thanks a lot everyone I've got quite a nice little homepage coming along thanks to the help here, so it's much appreciated. Quote
Wickham Posted July 6, 2009 Report Posted July 6, 2009 Note that Eric didn't include display: block; that's because when you style float: left it automatically converts the element to block; but of course you need to delete the display: inline or there will be a conflict (which he did). I usually include display: block where I've deliberately changed an inline element, even though float does it for me, just so that I have a reminder there that I changed it. Quote
Rob in hood Posted July 6, 2009 Author Report Posted July 6, 2009 Note that Eric didn't include display: block; that's because when you style float: left it automatically converts the element to block; but of course you need to delete the display: inline or there will be a conflict (which he did). I usually include display: block where I've deliberately changed an inline element, even though float does it for me, just so that I have a reminder there that I changed it. Ah, good to know! I'm slowly learning those little intracacies like that Quote
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.
Note: Your post will require moderator approval before it will be visible.