Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i create a change in font size on hover without realigning other text?

Tags:

html

css

I want to use the hover pseudoclass in css to increase the size of individual links in a table, however every time they are hovered over, the size increase affects the size of the rows/columns and all the other links in the table move in accordance.

Any way i can prevent this using only css and html?

like image 857
user1787489 Avatar asked Dec 28 '12 17:12

user1787489


People also ask

How do I change the text size in vary?

To make your font size smaller or larger: On your device, open the Settings app. Search and select Font size. To change your preferred font size, move the slider left or right.

How do I automatically adjust font size in HTML?

The font-size-adjust property gives you better control of the font size when the first selected font is not available. When a font is not available, the browser uses the second specified font. This could result in a big change for the font size. To prevent this, use the font-size-adjust property.


3 Answers

You can use CSS3 tranform to scale the links without causing re-positioning of surrounding elements, for example:

table a:hover{ -webkit-transform: scale(1.2); }

-webkit- can be changed for other vendors (e.g., -moz- and -ms-), but is not available in some browsers, including IE8.

Using line-height will not prevent horizontal movement, therefore expanding the column.

like image 113
Mooseman Avatar answered Oct 21 '22 11:10

Mooseman


You can do this way:

Set the initial height to the line-height.

td {line-height: 20px; font-size: 14px;}
td:hover {font-size: 20px;}

Fiddle: http://jsfiddle.net/mMZjf/

like image 29
Praveen Kumar Purushothaman Avatar answered Oct 21 '22 11:10

Praveen Kumar Purushothaman


Force the line-height height to be the same and change the font-size on hover.

Example here

like image 36
Alex Wayne Avatar answered Oct 21 '22 12:10

Alex Wayne