ユーザーのスクロール場所に関係なく、ページの中央にGIFを置いておきたい。私はそこにあるのではなく、イメージが「ページの上に浮いている」という錯覚が欲しいと思っています。HTMLページ上にGIFイメージを浮動させる
私はCSSがこれをやり遂げる方法だろうと思いますか?画像をfoo.gif
とすると、CSSはこれをどうするのでしょうか?
ユーザーのスクロール場所に関係なく、ページの中央にGIFを置いておきたい。私はそこにあるのではなく、イメージが「ページの上に浮いている」という錯覚が欲しいと思っています。HTMLページ上にGIFイメージを浮動させる
私はCSSがこれをやり遂げる方法だろうと思いますか?画像をfoo.gif
とすると、CSSはこれをどうするのでしょうか?
より具体的な何をしたいの指導、そしてその理由がなければ、私が提供できる最高のは、次のとおりです。
img {
position: fixed; /* forces the element to stay fixed in relation to the viewport */
top: 50%; /* sets the top of the image 50% of the page height */
left: 50%; /* sets the left side of the image 50% across the page */
margin-left: -100px; /* moves the image half of its own width to the left-side of the page */
margin-top: -93px; /* moves the image half its height 'up' the page */
box-shadow: 0.5em 0.5em 0.7em #333; /* to give the illusion of 'floating'
border-radius: 1em;
}
Davidに感謝します。 :) –
あなたが意味するか* [ドロップシャドウ]と同じように*浮動ます(http:// EN .wikipedia.org/wiki/Drop_shadow)?これまでに何を試しましたか? ['position:fixed'](http://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/)、[margin:auto'](http:// bluerobot。 com/web/css/center1.html)、...? –