Jump to content
  • 0

Резиновый див


svdsLis
 Share

Question

Проблема в следующем:

<div id="main">

<div id="1" />

<div id="2" />

</div>

Див main резиновый а див2 имеет фиксированный размер, как сделать чтобы див 1 заполнял всё свободное место, див 1 и 2 находятся на одной строке.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 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">
<head>
<title>[TITLE]</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
* {
padding:0;
margin:0;
}
body {
text-align:center;
}
#container {
width:80%;
margin:0 auto;
text-align:left;
}
#main {
padding-right:200px;
background:#f0f0f0;
overflow:hidden;
}
#first {
background:#c99;
}
#second {
float:right;
width:200px;
display:inline;
margin-right:-200px;
background:#99c;
}
#first,#second {
padding:10px;
}
</style>
</head>
<body>

<div id="container">
<div id="main">
<div id="second">
2
</div>
<div id="first">
1
</div>
</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