どんな位置を一つの画像のうちの一HTML?
-
09-06-2019 - |
質問
私は初心者でレールプログラミングよく画像を表示します一部のイメージを頂けます。を"わかりやすいことしかやらないという欲しい青の広場、赤の広場の右上にある青の広場が逼迫した。私の手続きを避けるための合成(ImageMagick類により性能の問題です。
ていただきたいと思い位置と重なる画像との対比します。
として、より困難とえば、想像してみてください走行メーター内に設置された大きなイメージです。により、文字になっていなければいけないと考えて複合万異なる画像は、一人でも、皆でも遊べる楽の飛行は、必要とされるものをすべては、画像にします。
解決
Ok、しばらくしてからもう一度、"わらびもち"をここで私が水揚げされた:
.parent {
position: relative;
top: 0;
left: 0;
}
.image1 {
position: relative;
top: 0;
left: 0;
}
.image2 {
position: absolute;
top: 30px;
left: 70px;
}
<div class="parent">
<img class="image1" src="https://placehold.it/50" />
<img class="image2" src="https://placehold.it/100" />
</div>
もっとも簡単な場合として溶液とする。るには:
を相対的に事業部では、流れのページをベースに画像として相対的にdiv先番号は予約確認通知に大き;会場のオーバーレイとして絶対は相対的に左上の最初のイメージです。フレキシビリティの親族および絶対正しい。
他のヒント
このbarebonesかっ浮かぶ一画像です。
img {
position: absolute;
top: 25px;
left: 25px;
}
.imgA1 {
z-index: 1;
}
.imgB1 {
z-index: 3;
}
<img class="imgA1" src="https://placehold.it/200/333333">
<img class="imgB1" src="https://placehold.it/100">
こちらのコードとしてお考:
<style>
.containerdiv { float: left; position: relative; }
.cornerimage { position: absolute; top: 0; right: 0; }
</style>
<div class="containerdiv">
<img border="0" src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt=""">
<img class="cornerimage" border="0" src="http://www.gravatar.com/avatar/" alt="">
<div>
思 エスポソリューション きではないので不便でする必要がある位置の両方の画像をおっしゃるとおりです。また、最初の位置のフローです。
通常、自然体でいる。き位置:相対的にコンテナ素子、その絶対位置の子供ることを確認できます。残念ながらつけることが出来ませんの画像内です。そんな理由で必要なコンテナ事業部通知するイメージして作成してみましたfloatでautofitます。で表示インライン-ブロックすべき理論的に作品としてもブラウザを支援はあります。
編集:削除してしまったサイズの属性からの画像例えばります。ご希望の場合はコンテナの画像をデフォルトのサイズが分からないときのサイズを事前に利用できませんの 背景トリック.ただしその場合は、それます。
課題のひとつであることに気が付きの原因になり誤差があrrichterの答えは、以下のコード:
<img src="b.jpg" style="position: absolute; top: 30; left: 70;"/>
を含めるべきであるpx台のスタイル例
<img src="b.jpg" style="position: absolute; top: 30px; left: 70px;"/>
その他にも、その答えは現代美術館などがあります。感謝。
すでに絶対位置 pseudo elements
の対比で親要素になります。
すきのエリアを表示一部のエリアを表層の遊びの各要素になっているので位置決め、一つの画像にもなりやすい最小限の意味マークアップ(空divsます。
マークアップ:
<div class="overlap"></div>
css:
.overlap
{
width: 100px;
height: 100px;
position: relative;
background-color: blue;
}
.overlap:after
{
content: '';
position: absolute;
width: 20px;
height: 20px;
top: 5px;
left: 5px;
background-color: red;
}
この ライブデモ
の方法を使用するためには、背景画像を投入するだけで、簡単に、 <img> その要素となります。
その他の方法ではcssます。あるトンの資源の利用お手伝いをさせていただいておりこれだけで検索 css層.
インラインスタイルにのみ明す。使用実CSSスタイルシートです。
<!-- First, your background image is a DIV with a background
image style applied, not a IMG tag. -->
<div style="background-image:url(YourBackgroundImage);">
<!-- Second, create a placeholder div to assist in positioning
the other images. This is relative to the background div. -->
<div style="position: relative; left: 0; top: 0;">
<!-- Now you can place your IMG tags, and position them relative
to the container we just made -->
<img src="YourForegroundImage" style="position: relative; top: 0; left: 0;"/>
</div>
</div>
@buti-ゼ:なpedanticが、コード情報を取り出すことができます。HTMLの width
や height
属性な各ユニット;まうというCSS width:
や height:
ます。また、あなたを提供コンテンツ型text/css
;見エスポーのコード)の <style>
タグです。
<style type="text/css">
.containerdiv { float: left; position: relative; }
.cornerimage { position: absolute; top: 0; right: 0; }
</style>
<div class="containerdiv">
<img border="0" src="http://www.gravatar.com/avatar/" alt="" width="100" height="100">
<img class="cornerimage" border="0" src="http://www.gravatar.com/avatar/" alt="" width="40" height="40">
<div>
退 px;
の width
や height
属性を引き起こす可能性のある描画エンジンをbalk.
っているので遅めのもこのことができるの?
HTML
<!-- html -->
<div class="images-wrapper">
<img src="images/1" alt="image 1" />
<img src="images/2" alt="image 2" />
<img src="images/3" alt="image 3" />
<img src="images/4" alt="image 4" />
</div>
SASS
// In _extra.scss
$maxImagesNumber: 5;
.images-wrapper {
img {
position: absolute;
padding: 5px;
border: solid black 1px;
}
@for $i from $maxImagesNumber through 1 {
:nth-child(#{ $i }) {
z-index: #{ $maxImagesNumber - ($i - 1) };
left: #{ ($i - 1) * 30 }px;
}
}
}