如何获得以下网站的工作信息,以便如果文本长于容器,(1)文本不会从底部滚动,并且(2)滚动条位于该容器的右侧浏览器,而不是在容器的右侧?如何从滚动容器底部滚动文本,但将滚动条保持在浏览器的最右侧?
(我想要浏览器右侧的滚动条的原因是因为如果它位于容器的右侧,那么当光标位于灰色区域时,鼠标滚轮不起作用令人不安的用户体验。)
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<style type="text/css">
.pagecontent {
margin: 0 18px;
}
/* bootstrap override */
.container {
width: 100%;
padding: 0;
}
.navbar {
border-radius: 0px;
}
.navbar-text {
float: left !important;
margin-right: 10px;
}
.navbar-right {
float: right!important;
}
.navbar-nav>li>a {
padding-top: 15px;
padding-bottom: 15px;
}
.navbar-nav {
margin-bottom: 0;
margin-top: 0;
margin-left: 0;
}
/* viewport lg */
@media (min-width: 1200px) {
.container {
width: 1024px;
padding: 0;
background-color: #fff;
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
/* overflow-y: auto; TEXT DOESN'T EXTEND OFF BOTTOM (GOOD), BUT SCROLL BAR IS ON CONTAINER NOT ON RIGHT OF BROWSER (BAD)*/
}
html{
min-height:100%;/* make sure it is at least as tall as the viewport */
position:relative;
}
body{
height:100%; /* force the BODY element to match the height of the HTML element */
background-color: #999;
/* overflow-y: auto; SCROLLBAR ON RIGHT OF BROWSER (GOOD) BUT TEXT EXTENDS OFF BOTTOM (BAD) */
}
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header pull-left">
<a class="navbar-brand" href="?">Bootstrap Showcase</a>
</div>
</div>
</nav>
<div class="pagecontent">
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
<div>this is a test line</div>
</div>
</div>
</body>
</html>
附录
如果我删除position: absolute;
,它修复了这个迫在眉睫的问题,但随后的容器不向下延伸至底部,如果疗法e是不够的文本,因为它正确时,有没有灰色背景:
如果我删除'position:absolute;'它修复了这个直接的问题,但是如果没有足够的文本,容器不会向下延伸到底部。我在我的文章中添加了上述截图。 –
编辑我的评论。这应该工作。 –