Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<div>ページの中央を基準にして、特定のピクセル数を配置したいと考えています。これはどのように行うことができますか?
<div>
水平方向の中心を取得するために使用できます$(window).width() / 2...次のようになります。
$(window).width() / 2
$('.myDiv').css({left: ($(window).width() / 2) - 50})
div 50px中央の左側にあります
div
50px