如何在div旁边制作div [英] how to make div beside div
本文介绍了如何在div旁边制作div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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>
<title> This is my site </title>
<link rel="stylesheet" type="text/css" href="StyleSheet.css">
</head>
<body>
<div id="bigger">
<div id="header">
<div id="adv">
</div>
<div id="flag">
</div>
</div>
</div>
</body>
</html>
CSS
#bigger
{
height:1280px;
width:880px;
margin:0px 0px 0px 0px;
position:absolute
}
#header
{
background-color:Blue;
height:10%;
width:100%;
position:absolute
}
#adv
{
background-color:Yellow;
height:100%;
width:35%
}
#flag
{
background-color:Red;
height:100%;
width:65%;
float:right
}
你如何使旗帜div出现在旁边在div头里的adv div?
How do you make the flag div appear beside the adv div inside the header div?
推荐答案
#adv
needs float:left
,所以它浮动到左边(并且 #flag
漂浮在它旁边的右边,因为 float:right
)。
#adv
needs float:left
, so it floats to the left (and #flag
floats to the right, next to it, because of float: right
).
这篇关于如何在div旁边制作div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文