View Single Post
Old 11-04-2015, 10:34 PM   #1
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
size relative to textsize

I want to embed a small image of a symbol in the text, to act as a letter.

Is there a way to style it so it scales with the text?

I've looked at several retail books and so far those that do this just have a small image, e.g 16x24 px, and put it as e.g.

.imgepub {height: auto; width: auto;}

So it stays at a constant size if you zoom the text.

So is there a way to refer to the current font size?

I tried
.textsize { height: inherit; width: inherit; }

But that didn't work; presumably it inherits from <img>.
I can't put it inside a <p> tag without starting a new paragraph.


Ten minutes later:
SOLUTION (Seems that stating the problem helps to solve it).

.textsize { height: 1em; width: 1em; }

-- maybe just
.textsize { height: 1em; }
would be more general, if you have an image of several symbols or a word.

Last edited by AlanHK; 11-04-2015 at 11:57 PM.
AlanHK is offline   Reply With Quote