Rizvan
Rizvan

Reputation: 2355

Text overflow in div tag

I type long string in divor span tag whenever i maximise the window (any browser) , it perfectly matches the div tag but when i minimise it or compress the browser width then text coming out of div area . I just want to know how to set long text in a div area either stretched or compressed . I tried ellipsis , white-space:nowrap .. nothing result i found . Is there any other solution for it ?

screen ex: When i compressed the browser width. enter image description here

Upvotes: 2

Views: 816

Answers (1)

Ahsan Khurshid
Ahsan Khurshid

Reputation: 9469

I hope you want something like this:

SEE DEMO

CSS:

div {
    // Div Styles Without Fixed Width and Height
    background: #ccc;
    padding: 20px;
    border: 1px solid #666;
}​

If you are using fixed height for <div> then you must define either a css property overflow:auto (for scrollbar to appear while content varies), or overflow:hidden; (to hide the text varies)

SEE EXAMPLE (overflow:auto)

SEE EXAMPLE (overflow:hidden)

Upvotes: 1

Related Questions