したがって、私はabsolute vs relative
とテストしており、ほとんどの部分について理解し始めています。あなたがabsolute
を使用し、親がrelative
である場合、それはあなたの親に関連する調整を使用することをその部分を得る。css相対vs 3レベルdivの絶対値
私がposition
に親を親にしたければ質問します。
どのようにする必要がありますか?
I have this repl which has this implementation。だから、基本的に、私はdiv要素2はdivの1に対する相対になりたい場合は
(しかし、divの2がすでにposition:relative
であり、absolute
を持っている3つのdivための親です)。
私はここで相対的なdivと絶対的なdivの2つの関係を作ることができます(しかし、それはすでに相対的です)。
正しいことは何ですか。
#one {
width:50px;
height:30px;
background-color:yellow;
margin:20px;
padding:15px;
top:200px;
}
#two {
width: 200px;
height: 100px;
background-color:red;
margin:10px;
padding:10px;
left:500px;
top:100px;
position:relative;
}
#three {
width:15px;
height:20px;
background-color:green;
position:absolute;
left:0px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="one">
<div id="two">
<div id="three"></div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
申し訳ありませんが、コードのリンクはありますか? – user3502374
あなたのリンクが亡くなった場合、この質問は役に立ちませんので、あなたの質問に含める方が良いでしょう。 – Swellar