0

I have a div with 0 height, but the text is not cutoff, only the div box. Example:

<div style="width:200px;height:10px;background-color:red;">
Text
</div>

I want it to cutoff the text to not overflow out of the div.

This is what it looks like:

*image1*

And this is what I want it to look like:

image2

2
  • 3
    what happens if you use overflow:hidden ? Commented Jul 24, 2012 at 1:47
  • @Dips it must be the answer.. :) Commented Jul 24, 2012 at 1:50

4 Answers 4

1

Add this to the main div

overflow:hidden;
Sign up to request clarification or add additional context in comments.

Comments

1

You need to use overflow:hidden;

Here is an example: http://jsfiddle.net/v4ykN/

This is a good overview of the overflow property: http://css-tricks.com/the-css-overflow-property/ with some good info to remember:

bear in mind that content that is hidden in this way is utterly inaccessible (short of viewing the source). So for example a user has their default font size set larger than you would expect, you may be pushing text outside of a box and hiding it completely from their view.

Comments

1

Please Use Overflow:hidden in css Refer this example http://www.w3schools.com/cssref/tryit.asp?filename=trycss_overflow

Comments

0

You must use overflow:hidden; Good luck with what you are doing

2 Comments

This answer has already been posted numerous times. You do not add anything of value with this answer.
I'm terribly sorry, i'm very new to this website, wont happen again :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.