|
| |
|
|
slbergh
Posts: 322 Joined: 11/8/2002 From: Iowa Status: offline
|
Cropping fun with CSS - 3/7/2006 11:25:36
Because I always have to be a little bit different, I was wondering if anyone knows of a way to apply the CSS button attribute "crop" to text (probably in a span). We're pulling course names from a database and they can get pretty long. We have a fixed div width to hold them, and right now, they just wrap. Some of the names are long enough that they end up wrapping to 3 lines, which looks awful. I suggested to our ASP god-in-training that we find a way to crop the text when it hits the edge of the div and just add an ellipsis (...) instead. The text serves as a link to a full course description, so it's not like people would be missing out completely on the whole title. I've done some looking and have found "crop", but only in relation to things that use a label, such as a button. I'm sure with enough neurons firing, I could figure it out on my own, but I don't have any left. Five weeks of 80-90 hour weeks trying to fix a former programmer's nasty, unstable, ugly, !(@*#%&*@% code, all while answering nonstop and angry phone calls from people trying to use a barely functional web application, has left me barely able to remember my own name! Thanks in advance to whoever wants to think for me! 
_____________________________
Digital data lasts forever...or 5 years, whichever comes first!
|
|
|
|
Tailslide
Posts: 6272 Joined: 5/10/2005 From: Out here on the raggedy edge Status: offline
|
RE: Cropping fun with CSS - 3/7/2006 11:45:25
The only thing I can think of off the top of my head would be to stick the course title in a paragraph tag or other block level item and then assign it a height and width and overflow:hidden. Trouble is you'll get words being cut in half - it wouldn't look very good. I think you'd be better off doing it via the ellipsis method you mention - much much nicer looking. Edit: beaten to it!
_____________________________
"My strategy is so simple an idiot could have devised it" Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project
|
|
|
|
d a v e
Posts: 4170 Joined: 7/24/2002 From: England (but live in Finland now) Status: offline
|
RE: Cropping fun with CSS - 3/7/2006 12:57:49
if the text is coming from a database then can't you get your asp guy to limit the character length of the name there before it gets to the div??
_____________________________
David Prescott Gekko web design
|
|
|
|
dpf
Posts: 7126 Joined: 11/12/2003 From: India-napolis Status: offline
|
RE: Cropping fun with CSS - 3/7/2006 13:03:19
quote:
if the text is coming from a database then can't you get your asp guy to limit the character length of the name there before it gets to the div?? that would be simple to do....
_____________________________
Dan
|
|
|
|
slbergh
Posts: 322 Joined: 11/8/2002 From: Iowa Status: offline
|
RE: Cropping fun with CSS - 3/7/2006 13:32:34
Ever notice how it's the simple solutions you completely overlook? He and I had a 15 minute brainstorming session yesterday morning on how to do this (one of mine was actually the right-aligned ellipsis image) and neither of us thought of that! Thanks, guys!
_____________________________
Digital data lasts forever...or 5 years, whichever comes first!
|
|
|
|
d a v e
Posts: 4170 Joined: 7/24/2002 From: England (but live in Finland now) Status: offline
|
RE: Cropping fun with CSS - 3/7/2006 13:33:45
other people's problems are always easier than your own ;)
_____________________________
David Prescott Gekko web design
|
|
|
|
dpf
Posts: 7126 Joined: 11/12/2003 From: India-napolis Status: offline
|
RE: Cropping fun with CSS - 3/7/2006 14:36:49
quote:
other people's problems are always easier than your own ;) amen brother
_____________________________
Dan
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|