admin管理员组

文章数量:1326076

I want to display some text in a inline popup window with ok/close button.

I implemented and bit modified Custom Alert but sometimes the text has too many lines so I need the window scrollable.

I want to use only javascript. No framework nor libraries.

I want to display some text in a inline popup window with ok/close button.

I implemented and bit modified Custom Alert but sometimes the text has too many lines so I need the window scrollable.

I want to use only javascript. No framework nor libraries.

Share Improve this question asked Mar 2, 2011 at 23:00 RadekRadek 11.1k56 gold badges169 silver badges270 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

you should be able to acplish that with css

With the default style it would be like this:

#alertBox p {
    font:0.7em verdana,arial;
    height:50px;
    padding-left:5px;
    margin-left:55px;
    overflow:auto;
}

Example on jsfiddle.

Also as Casablanca points out, if you want to assign a specific class you can modify the javascript to use

msg.className = 'messageBox';

and then your own css

.messageBox{
  overflow:auto;
}

本文标签: scrollhow to do css div pop up scrollable using only javascriptStack Overflow