Ryan
Ryan

Reputation: 6227

Can text overflow ellipsis target one element?

I'm trying to shorten a URL with text overflow ellipsis to keep things short in Mobile Safari.

Here is my code and page.

dd a {
    text-overflow:ellipsis;
    white-space:nowrap;
    overflow:hidden;
    width:20px;
    background:red; /* for debugging */
}

Upvotes: 2

Views: 1018

Answers (3)

David Kaneda
David Kaneda

Reputation: 5500

You have the right start, the only problem is the rules aren't all being applied because a tags are inline by default and need to be block-level. Adding "display: block" to your CSS will do the trick and, luckily, because of the way you're styling your dds, it won't change your layout. Also, nix the 20px width :)

Upvotes: 1

cmplieger
cmplieger

Reputation: 7371

Here, check out the new css3 selectors and you'll quickly be able to select whatever element you want :)

http://www.w3.org/TR/css3-selectors/#selectors

Upvotes: 0

Charlie Martin
Charlie Martin

Reputation: 112404

The question is a little hard to parse, but basically yes. The CSS selector could be for just one element. The easiest way would be to give the element an id, like id="mythingie" and have the selector use that.

#mythingie {
    text-overflow:ellipsis;
    white-space:nowrap;
    overflow:hidden;
    width:20px;
    background:red; /* for debugging */
}

Upvotes: 0

Related Questions