Is it possible to split a string based on the pixel-length, not the character-length?
I don’t want a headline of an article to break line and “destroy” the design.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ASP pages are working on the server-side.
The pixel-length or the characher-length of a text is dependent on which font is being used in the browser on the client side.
There are fonts called mono-spaced. That means all the letters of the fonts have fixed length. If you are using this type of font then you can calculate the pixel-length of the text. Like:
Or, if the font is not a mono-spaced font, then maybe you can create an array of pixel-lengths for the font for yourself. And maybe calculate the pixel-length of the whole text, but I discourage you to do it that way because its much more hard-code needed!
And my question to your question is.. Why you are trying to achieve that with asp (the server-side language)?