The Little Guy Posted November 30, 2008 Share Posted November 30, 2008 I have user names, that are in a div, in a h1 tag. Is it possible to use css to resize the name according to the name length? I tried this, but doesn't it work: <div> <h1 style="font-size:100%;">The Little Guy</h1> </div> Link to comment https://forums.phpfreaks.com/topic/134839-font-size-according-to-the-length/ Share on other sites More sharing options...
haku Posted November 30, 2008 Share Posted November 30, 2008 You can only do this with javascript, it won't work with just CSS. CSS cannot do calcuations based on content. Link to comment https://forums.phpfreaks.com/topic/134839-font-size-according-to-the-length/#findComment-702170 Share on other sites More sharing options...
josephman1988 Posted November 30, 2008 Share Posted November 30, 2008 Agreed, or PHP, count the characters in a string and implement a CSS style depending on the lentgh. Link to comment https://forums.phpfreaks.com/topic/134839-font-size-according-to-the-length/#findComment-702205 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.