Jump to content

Recommended Posts

Posted

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?

Posted

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.....

Posted

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!

Posted (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 by Eric
Posted (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 by Wickham
Posted

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

Posted

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.

Posted
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 :)

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...