[英]moving image along with the scroll inside a TD or DIV
I have a table of height > 1000. It has Prev and Next buttons on the first and last TDs respectively. 我有一个高度> 1000的表。它在第一个和最后一个TD上分别具有Prev和Next按钮。 I want the Prev and Next button to be positioned in the middle with respect to the screen.
我希望“上一个”和“下一个”按钮相对于屏幕位于中间。 I do not want to use JQuery.
我不想使用JQuery。
TABLE - _________________________________________ | | | | | TD1 | TD2 | TD3 | | | | | | | | | |--------|---------------------|--------|----------------------------- | | | | _ | | | | | | | | | | | | | | | | ## | | ## | Screen view now | | | | | | | | | | | | | | | | | | | _ |--------|---------------------|--------|----------------------------- | | | | | | | | | | | | | | | | ----------------------------------------- Legend : ## - Button
Set style for button elements: 设置按钮元素的样式:
.button {
position: fixed;
top: 50%;
}
Although buttons won't be exactly in the middle (plus half of height), should look ok 尽管按钮不会正好位于中间(高度的一半),但应该看起来不错
try using CSS. 尝试使用CSS。 give each of your buttons a class and adjust their margins.
给每个按钮一个类,并调整其边距。 Example:
例:
HTML 的HTML
<div class="btnNext"> button info goes here </div>
<div class="btnPrev"> button info goes here </div>
CSS 的CSS
.btnNext
{
margin-left: auto;
margin-right: auto;
position: fixed;
bottom: 0px;
}
.btnPrev
{
margin-left: auto;
margin-right: auto;
position: fixed;
bottom: 0px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.