<style>
.content { width: 60%; height: 2000px; background: #999; margin: 0 auto;}
.h0 { height: 0;}
.ovh { overflow: hidden;}
.tr { text-align: right;}
.abs { position: absolute; width: 20px; height: 20px; background: #F00;}
.ml10 { margin-left: 10px;}
.mt30 { margin-top: 30px;}
</style>
</head>
<body>
<div class="content">
<div class="h0 ovh tr">
<a class="abs ml10 mt30"></a>
</div>
</div>
</body>
这样写还是会跟随的赶脚
content外面加一层设置高度,出现滚动条就ok了
<style> .warp { height:300px; overflow-y:auto;} .content { width: 60%; height: 2000px; background: #999; margin: 0 auto;} .h0 { height: 0;} .ovh { overflow: hidden;} .tr { text-align: right;} .abs { position: absolute; width: 20px; height: 20px; background: #F00;} .ml10 { margin-left: 10px;} .mt30 { margin-top: 30px;} </style>
<body> <div class="warp"> <div class="content"> <div class="h0 ovh tr"> <a class="abs ml10 mt30"></a> </div> </div> </div> </body>