Jump to content
  • 0

body, див-ы, два слоя


Razor
 Share

Question

Имеем div, в нём два дочерних div-а.

У контейнера position: relaitve;

У дочерних position: absolute; (чтобы реализовать соли).

Проблема: как вытянуть контейнер на высоту самого большого дочернего div-а?

Edited by Razor
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Насколько мне известно слой так не вытянуть. Можно задать ему определённую высоту, но то что вы хотите сделать, намного удобнее проделывать с таблицами.

Link to comment
Share on other sites

  • 0

а надо ли делать абсолютное позиционирование,чтобы их наложить друг на друга?

так не пойдет?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>многослойность</title>
<meta http-equiv="Content-Type" content="text/html; charset=cp1251">
<meta http-equiv="imagetoolbar" content="false">
<meta name="Author" content="">
<meta name="Keywords" content="<TPL:KEYWORDS>">
<meta name="Description" content="<TPL:DESCRIPTION>">
<link rel="stylesheet" type="text/css" href="index_files/style_template_div.css" media="all">
</head>
<body>
<div style="width:500px; height:500px; z-index:0;background:white;"> 
<div style="position:relative; top:350px; margin-top:-350px; left:0px; width:350px; height:350px; z-index:3;background:green;">
 
</div>
<div style="position:relative; top:200px; margin-top:-200px; left:0px; width:200px; height:200px; z-index:6;background:blue;">
 
</div>
<div style="position:relative; top:300px; margin-top:-300px; left:0px; width:300px; height:300px; z-index:4;background:yellow;">
 
</div>
<div style="position:relative; top:250px; margin-top:-250px; left:0px; width:250px; height:250px; z-index:5;background:red;">
 
</div>
<div style="position:relative; top:400px; margin-top:-400px; left:0px; width:400px; height:400px; z-index:2;background:gray;">
 
</div>
<div style="position:relative; top:450px; margin-top:-450px; left:0px; width:450px; height:450px; z-index:1;background:brown;">
 
</div>
</div>
</body>
</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy