Html 为什么一个部门不在另一个部门旁边?
我正在创建一个网站,但我有一些问题与定位的div。 我的Html 为什么一个部门不在另一个部门旁边?,html,css,web,position,css-float,Html,Css,Web,Position,Css Float,我正在创建一个网站,但我有一些问题与定位的div。 我的内容div未定位在导航栏div旁边,即使我将它们都向左浮动 下面是HTML代码。 问题是导航栏div和内容div不会相邻放置,而是内容div将自身定位在导航栏div下方 谢谢。在导航栏中添加一个浮动:left怎么样 在导航栏中添加一个浮动:left怎么样 您正在使用的float:left #navigation-bar { background-color: #606060; width: 15%; height: 70
内容div
未定位在导航栏div
旁边,即使我将它们都向左浮动
下面是HTML代码。
问题是导航栏div
和内容div
不会相邻放置,而是内容div
将自身定位在导航栏div
下方
谢谢。在
导航栏中添加一个浮动:left
怎么样
在导航栏中添加一个浮动:left
怎么样
您正在使用的float:left用于导航栏的代码>
#navigation-bar
{
background-color: #606060;
width: 15%;
height: 70%;
color: white;
text-align: center;
padding: 2%;
font-size: 80%;
border: 4px solid blue;
float: left; <--- Add this Here
}
#导航栏
{
背景色:#606060;
宽度:15%;
身高:70%;
颜色:白色;
文本对齐:居中;
填充:2%;
字号:80%;
边框:4px纯蓝色;
float:left;您正在使用float:left;
作为#导航栏
#navigation-bar
{
background-color: #606060;
width: 15%;
height: 70%;
color: white;
text-align: center;
padding: 2%;
font-size: 80%;
border: 4px solid blue;
float: left; <--- Add this Here
}
#导航栏
{
背景色:#606060;
宽度:15%;
身高:70%;
颜色:白色;
文本对齐:居中;
填充:2%;
字号:80%;
边框:4px纯蓝色;
float:left;我太笨了,我忘了在导航栏div中添加“float:left”。我太笨了,我忘了在导航栏div中添加“float:left”。
#navigation-bar
{
background-color: #606060;
width: 15%;
height: 70%;
color: white;
text-align: center;
padding: 2%;
font-size: 80%;
border: 4px solid blue;
float: left; <--- Add this Here
}