我有一个固定在视口底部的页脚。我正在使用 jQuery toggle 打开评论卡,供用户评论和提交:
$('a#footer-comment').click(function() {
$("#comment-card").toggle(300);
return false;
$('#comment-card').show({ position:);
});
$('a#footer-comment-hide').click(function() {
$("#comment-card").toggle(300);
return false;
$('#comment-card').hide();
});
自然,如果我不向#comment-card 添加任何 CSS 选择器,它会显示在页脚下方,并且看不见。
所以我添加了:{position:absolute; bottom:30px; left:auto;}
30px,所以它显示在 30px 高的页脚上方。
问题是,我不能让它在视口中居中......如果我使用像素,取决于分辨率,它要么太左要么太右......我如何在视口中居中?