/    Sign up×
Community /Pin to ProfileBookmark

Only show text that fits in <div>?

Hi

Is it possible to only show the part of a text that can fit into a div?

I have this css:

[CODE]#cell {
line-height: 18px;
display: inline;
float: left;
}[/CODE]

But it makes a linebreak if the width of the div is to small! I just want it to hide what does not fit in!

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@OctoberWindNov 29.2010 — define your maximum width for your div, then apply "overflow: hidden;"
Copy linkTweet thisAlerts:
@dbkauthorNov 29.2010 — well the width is a persentage of the screen!

Is it possible to only allow one line?
Copy linkTweet thisAlerts:
@Reli4ntNov 30.2010 — You could set the height to a specific value then use overflow: hidden;
Copy linkTweet thisAlerts:
@stefanrajDec 01.2010 — You can specify the fixed height for the div as how many lines you want to display in the div.
Copy linkTweet thisAlerts:
@drymszaDec 01.2010 — Indeed, I would make a height and set overflow to hidden. I'd start with a figure around your line height and adjust until your happy with how it looks.
×

Success!

Help @dbk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...