Html 侧边栏位于内容下方
我试图从我的内容右侧添加侧边栏,但它位于侧边栏下方。我真的不明白问题是什么,我已经尝试过改变一切,但仍然不起作用 CSS: 我的一页:Html 侧边栏位于内容下方,html,css,Html,Css,我试图从我的内容右侧添加侧边栏,但它位于侧边栏下方。我真的不明白问题是什么,我已经尝试过改变一切,但仍然不起作用 CSS: 我的一页: <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <style> </style> </head> <body> <div id="header"> <h1>Обр
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<style>
</style>
</head>
<body>
<div id="header">
<h1>Образовательные программы </h1>
<table border="0" cellpadding="50">
<tr>
<th><a href='/first.php' target="content" style="color: #E8E8E8">Главная</a></th>
<th><a href='/search.php' target="content" style="color: #E8E8E8">Поиск</a></th>
<th><a href='/2.php'target="content" style="color: #E8E8E8">Задать вопрос</a></th>
<th><a href='/3.php'target="content"style="color: #E8E8E8">Контакты</a></th>
<th><a href='/all_list.php'target="content" style="color: #E8E8E8">Админка</a></th>
<th><a href='/category.php'target="content" style="color: #E8E8E8">Категории</a> </th>
</tr>
</table>
</div>
<div id="wrapper">
<div id="content">
<h1 align="center">Страница администратора</h2>
<?php
$conn = mysql_connect ("localhost", "root", "") or die ("Соединение не установлено!");
mysql_select_db('university'); // выбор БД
mysql_query("SET NAMES 'utf8'"); // кодировка
echo '<table border="1" cellspacing="0" cellpadding="12" align="center">';
echo '<thead>';
echo '<tr>';
echo '<th>ID</th>';
echo '<th>Название</th>';
echo '<th>1</th>';
echo '<th>2</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$res = mysql_query("SELECT * FROM news");
while($news = mysql_fetch_assoc($res)) {?>
<tr>
<td><a href="detail.php?id=<?=$news['id']?>"><?=$news['id']?></td>
<td><a href="detail.php?id=<?=$news['id']?>"><?=$news['program']?></td>
<td><a href="delete.php?id=<?=$news['id']?>">Удалить</td>
<td><a href="edit_form.php?id=<?=$news['id']?>">Редактировать</td>
</tr><?
}?>
</tbody></table>
<form name="add" action="add_form.php">
<p><input type="submit" value="Добавить программу"></p>
</div>
<div id="sidebar">
<h2>Here i will have sidebar</h2>
</div>
</div>
</body>
</html>
Образовательные программы
Страница администратора
你的数学完全不同步:你的#wrapper
设置为990px
#内容宽度
+#内容边距
+#边栏宽度
..
700px
+220px
+250px
=1170px
要么增加包装,要么减少内容的边距。你的布局不是完美的。。您的ID标题
具有100%
宽度,而ID包装
为990px
使用百分比或px值
如上所述,使用边距和宽度
为ID内容和侧栏提供float:left
,并在%中提供宽度
使用Firebug,我可以看到ID为slidebar
的div被标记包装
我希望清除所有这些混乱,你的布局将得到修复。请也包括你的标记。如果你能设置一个JS标记,那将是非常好的/csc请创建一个小提琴,但我不使用javascriptpost你的html脚本
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<style>
</style>
</head>
<body>
<div id="header">
<h1>Образовательные программы </h1>
<table border="0" cellpadding="50">
<tr>
<th><a href='/first.php' target="content" style="color: #E8E8E8">Главная</a></th>
<th><a href='/search.php' target="content" style="color: #E8E8E8">Поиск</a></th>
<th><a href='/2.php'target="content" style="color: #E8E8E8">Задать вопрос</a></th>
<th><a href='/3.php'target="content"style="color: #E8E8E8">Контакты</a></th>
<th><a href='/all_list.php'target="content" style="color: #E8E8E8">Админка</a></th>
<th><a href='/category.php'target="content" style="color: #E8E8E8">Категории</a> </th>
</tr>
</table>
</div>
<div id="wrapper">
<div id="content">
<h1 align="center">Страница администратора</h2>
<?php
$conn = mysql_connect ("localhost", "root", "") or die ("Соединение не установлено!");
mysql_select_db('university'); // выбор БД
mysql_query("SET NAMES 'utf8'"); // кодировка
echo '<table border="1" cellspacing="0" cellpadding="12" align="center">';
echo '<thead>';
echo '<tr>';
echo '<th>ID</th>';
echo '<th>Название</th>';
echo '<th>1</th>';
echo '<th>2</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$res = mysql_query("SELECT * FROM news");
while($news = mysql_fetch_assoc($res)) {?>
<tr>
<td><a href="detail.php?id=<?=$news['id']?>"><?=$news['id']?></td>
<td><a href="detail.php?id=<?=$news['id']?>"><?=$news['program']?></td>
<td><a href="delete.php?id=<?=$news['id']?>">Удалить</td>
<td><a href="edit_form.php?id=<?=$news['id']?>">Редактировать</td>
</tr><?
}?>
</tbody></table>
<form name="add" action="add_form.php">
<p><input type="submit" value="Добавить программу"></p>
</div>
<div id="sidebar">
<h2>Here i will have sidebar</h2>
</div>
</div>
</body>
</html>