|
Iniciado por W3C
ValueDescription
StaticDefault. An element with position: static always has the position the normal flow of the page gives it (a static element ignores any top, bottom, left, or right declarations) RelativeAn element with position: relative moves an element relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position AbsoluteAn element with position: absolute is positioned at the specified coordinates relative to its containing block. The element's position is specified with the "left", "top", "right", and "bottom" properties FixedAn element with position: fixed is positioned at the specified coordinates relative to the browser window. The element's position is specified with the "left", "top", "right", and "bottom" properties. The element remains at that position regardless of scrolling. Works in IE7 (strict mode) |

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Documento sin título</title>
<style type="text/css">
<!--
body {
text-align: center;
}
.div01 {
margin-right: auto;
margin-left: auto;
margin-top: 100px;
width: 700px;
}
.div02 {
height: 20px;
width: 200px;
background-color: #996600;
margin-top: 200px;
margin-left: 30px;
float: left;
}
.div03 {
height: 200px;
width: 200px;
background-color: #996600;
margin-top: 50px;
margin-left: 30px;
float: left;
}
.div04 {
height: 20px;
width: 400px;
background-color: #996600;
margin-left: auto;
margin-right: auto;
}
-->
</style>
</head>
<body>
<div class="div01">
<div class="div04">hola esto esta centrado</div>
<div>
<div class="div03">imagen</div><div class="div02">buscar</div>
</div>
</div>
</body>
</html>
|
Iniciado por p4bl1t0
si konzerte, pero usaste posiciones absolutas, como seria con fixed?
EDIT: como se podria hacer algo que no sea tan absoluto? |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Documento sin título</title>
<style type="text/css">
<!--
body {
text-align: center;
}
.div01 {
left: 50%;
position: absolute;
}
.div02 {
height: 20px;
width: 200px;
background-color: #996600;
float: left;
position: absolute;
left: 27px;
top: 211px;
}
.div03 {
height: 200px;
width: 200px;
background-color: #996600;
float: left;
position: absolute;
left: -211px;
top: 142px;
}
.div04 {
height: 20px;
width: 400px;
background-color: #996600;
margin-left: auto;
margin-right: auto;
position: absolute;
left: -201px;
top: 86px;
}
-->
</style>
</head>
<body>
<div class="div01">
<div class="div04">hola esto esta centrado</div>
<div class="div03">imagen</div><div class="div02">buscar</div>
</div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Documento sin título</title>
<style type="text/css">
<!--
body {
text-align: center;
}
.div02 {
height: 20px;
width: 200px;
background-color: #996600;
position: fixed;
top: 200px;
left: 450px;
}
.div03 {
height: 200px;
width: 200px;
background-color: #996600;
position: fixed;
top: 200px;
left: 200px;
}
.div04 {
height: 20px;
width: 400px;
background-color: #996600;
position: fixed;
top: 100px;
left: 250px;
}
-->
</style>
</head>
<body>
<div class="div04">hola esto esta centrado</div>
<div class="div03">imagen</div>
<div class="div02">buscar</div>
</body>
</html>
k
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="author" content="luxiano" /> <title>pruebas</title> <style type="text/css"> body { font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size: 1em; color: #353535; } #wrap { width: 100%; } #content { width: 760px; margin: 0 auto; } #header { height: 200px; } .titulo { text-align: center; } </style> </head> <body> <div id="wrap"> <div id="header">A ver si se arreglan los problemas</div> <div id="content"> <p class="titulo">hola esto esta centrado</p> <img src="jirafa.png" alt="jirafa" /> <input type="text" value="Ingrese nombre" size="50" /> <select></select> <input type="button" value="Buscar" /> </div> </div> </body> </html>
| Herramientas | Buscar en Tema |
| Desplegado | |
|