navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Cropping fun with CSS

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Cropping fun with CSS
Page: [1]
 
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!
spitfire

 

Posts: 424
Joined: 8/6/2005
Status: offline

 
RE: Cropping fun with CSS - 3/7/2006 11:44:55   
Did you think about overflow:hidden
Here's a bit about text-overflow:ellipsis but it only works in IE.

You could cross-browerize it, after a fashion, I suppose by using a background image of three dots positioned to the right. If this doesn't help Google has loadsalinks:)

One day let's hope just plain old overflow:ellipsis (in CSS3) will be adopted across the browsers - but don't hold your breath until then :)

(in reply to slbergh)
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

(in reply to slbergh)
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

(in reply to Tailslide)
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

(in reply to d a v e)
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!

(in reply to dpf)
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

(in reply to slbergh)
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

(in reply to d a v e)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Cropping fun with CSS
Page: [1]
Jump to: 1





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