Jump to content
  • 0

Зазор между "плавающими" div'ами


Vertachilo
 Share

Question

Задача:

Сделать 2 "резиновых" дива с заданным цветом и родительским дивом.

Первый див прижат влево, второй вправо.

Проблема:

В opera, chrome, safari между дивами появляется зазор в 1 пиксель сразу или при масштабирование окна браузера по ширине.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="ru" />
<title>The table</title>
<style type="text/css">
html, body {
margin:0px;
padding:0px;
}
#div0 {
width:100%;
background-color:red;
height:12px;
}
#div1 {
width:75%;
float:left;
background-color:green;
height:12px;
}
#div2 {
width:25%;
float:right;
background-color:black;
height:12px;
}
</style>
</head>
<body>
<div id="div0">
<div id="div1"></div>
<div id="div2"></div>
</div>
</body>
</html>

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

а если так?


<style type="text/css">
html, body {
margin:0px;
padding:0px;
}
#div0 {
background-color:red;
height:12px;
overflow:hidden;
}
#div1 {
margin-right:25%;
background-color:green;
height:12px;
}
#div2 {
width:25%;
float:right;
background-color:black;
height:12px;
}
</style>
</head>
<body>
<div id="div0">
<div id="div2"></div>
<div id="div1"></div>
</div>
</body>
</html>

  • Like 1
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