非常に単純な問題ですが、私は JavaScript を初めて使用します。 と の両方でJS を使用してmargin-topプロパティを追加しようとしていますが、うまくいきません。divdocument.readywindow.resize
function cent() {
var blockheight = $("#block").height();
var margintop = (blockheight / -2);
$block.css("margin-top", margintop);
};
$(document).noConflict();
$(document).ready(cent);
$(window).resize(cent);