如何在div中制作长文本消息

时间:2012-04-26 04:48:12

标签: css

我在div框中有一条很长的消息,我正在寻找一种方法来显示带有滚动条(垂直)的div中的文本消息,我有两个指向它的链接,如你所见: 1)声明 2)行为 以上链接是超链接所以当我点击这些链接时,我会根据选择显示下面的div。那么可以用超级模型div或其他东西显示超链接下面的div吗?

我不是一个CSS人,所以如果可能的话,让div框看起来很棒:)

<span ><a href="#" >Disclaimer-1</a></span> <span class="slide1">
        &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" class="slide1">Behavior</a></span>
    <div id="one" >
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s 
    </div>
    <div id="second" >
          Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s    
    </div>

2 个答案:

答案 0 :(得分:1)

如果您想要滚动条,请设置height,然后设置overflowautoscroll

div#one,
div#two
{
    height: 120px;
    overflow: auto;
}

至于你的最新编辑,你正在寻找JavaScript来实现类似的东西。

答案 1 :(得分:0)

您好了左边的滚动条并格式化页面,请找到您可以使用的基本CSS。

<style type="text/css">
        #one{
            overflow-y: scroll;
            padding:  15px;
            height: 150px;
            line-height: 25px;
            margin: 20px 0px 20px 0px;
        }
        #second{
            overflow-y: scroll;
            padding:  15px;
            height: 150px;
            line-height: 25px;
        }
        span a{
         padding-left:15px;
         color:blue;
         text-decoration: none;
         }
        span a:hover{
         padding-left:15px;
         color:blue;
         text-decoration: none;
        }

    </style>

请指定点when i click on the div i just need the div to be underneath the links

谢谢..