Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
Сега колкото и да променяш padding-a, разтоянието от горния ръб на основния див спрямо гоорния ръб на вложения див няма да се промени<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Untitled Document</title>
<style type="text/css">
#main {
width:400px;
height:400px;
border:solid 1px red;
position:relative;
padding-top:50px; /* пробвай да промениш стойността */
}
#second {
width:100px;
height:100px;
border:solid 1px blue;
position:absolute;
top:20px;
left:40px;
}
</style>
</head>
<body>
<div id="main">
<div id="second"></div>
</div>
</body>
</html>
emagi каза:Ето какво предлагам аз:
Сега колкото и да променяш padding-a, разтоянието от горния ръб на основния див спрямо гоорния ръб на вложения див няма да се промени<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Untitled Document</title>
<style type="text/css">
#main {
width:400px;
height:400px;
border:solid 1px red;
position:relative;
padding-top:50px; /* пробвай да промениш стойността */
}
#second {
width:100px;
height:100px;
border:solid 1px blue;
position:absolute;
top:20px;
left:40px;
}
</style>
</head>
<body>
<div id="main">
<div id="second"></div>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Untitled Document</title>
<style type="text/css">
#main {
width:400px;
height:400px;
border:solid 1px red;
position:relative;
padding-top:50px; /* пробвай да промениш стойността */
}
#second {
width:100px;
height:100px;
border:solid 1px blue;
position:absolute;
top:0px;
left:40px;
}
</style>
</head>
<body>
<div id="main">
<div id="second"></div>
</div>
</body>
</html>
emagi каза:Как да не става.Ти разцъка ли кода малко?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Untitled Document</title>
<style type="text/css">
#main {
width:400px;
height:400px;
border:solid 1px red;
position:relative;
padding-top:50px; /* пробвай да промениш стойността */
}
#second {
width:100px;
height:100px;
border:solid 1px blue;
position:absolute;
top:0px;
left:40px;
}
</style>
</head>
<body>
<div id="main">
<div id="second"></div>
</div>
</body>
</html>
div.body {
width: 890px;
height: 500px;
background-color: #fff;
padding-left: 10px;
text-align: justify;
position: relative;
padding-top: 10px;
}
div.car {
width: 140px;
height: 200px;
border-left: 1px solid #000;
border-bottom: 1px solid #000;
background-color: #fff;
float: right;
top: 0px;
}
Защо ли не ти вярвам!Foxy каза:естествено
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Untitled Document</title>
<style type="text/css">
.body {
width: 890px;
height: 500px;
background-color: #fff;
padding-left: 10px;
text-align: justify;
position: relative;
padding-top: 100px;
border:solid 1px red;
}
.car {
width: 140px;
height: 200px;
border-left: 1px solid #000;
border-bottom: 1px solid #000;
background-color: #fff;
top: 0px;
border:solid 1px blue;
position:absolute;
left:740px; /* от тук си намества разтоянието от левия ръб на главния див */
}
</style>
</head>
<body>
<div class="body">
<div class="car"></div>
</div>
</body>
</html>