Лучше всего создать новый <div>
специально для содержимого:
<div class="content">
arbitrary text
</div>
Затем вы можете расположить <div>
так, чтобы он заполнил оставшееся пространство:
.content {
margin: 0 0 0 300px;
}
body {
margin: 0;
}
.topwrapper {
height: 60px;
}
.sidewrapper {
width: 300px;
}
.topbar {
background-color: grey;
position: fixed;
width: 100%;
height: 60px;
margin: 0;
}
.topbar ul {
list-style-type: none;
}
.topbar li {
color: blue;
}
.topbar a:hover {
background-color: black;
}
.sidebar {
background-color: black;
position: fixed;
width: 300px;
height: 100%;
margin: 0;
}
.sidebar ul {
list-style-type: none;
}
.sidebar li {
color: blue;
}
.sidebar a:hover {
background-color: white;
}
.content {
margin: 0 0 0 300px;
}
<!DOCTYPE HTML>
<html>
<head>
<title>Webpage</title>
</head>
<body>
<div class="topwrapper">
<div class="topbar">
<ul>
<li><a style="float: left">Link 1</a></li>
<li><a style="float: left">Link 2</a></li>
<li>
<p style="float: right">Welcome</p>
</li>
</ul>
</div>
</div>
<div class="sidewrapper">
<div class="sidebar">
<ul>
<li><a>Link 3</a></li>
<li><a>Link 4</a></li>
<li>
<p>Welcome</p>
</li>
</ul>
</div>
</div>
<div class="content">
arbitrary text
</div>
</body>
</html>
Я также предоставил jsfiddle .
Если вы хотите, чтобы ваш код был семантически правильным, вы можете использовать <main>
вместо <div class="content">
, а затем изменить css на ...
main {
margin: 0 0 0 300px;
}
body {
margin: 0;
}
.topwrapper {
height: 60px;
}
.sidewrapper {
width: 300px;
}
.topbar {
background-color: grey;
position: fixed;
width: 100%;
height: 60px;
margin: 0;
}
.topbar ul {
list-style-type: none;
}
.topbar li {
color: blue;
}
.topbar a:hover {
background-color: black;
}
.sidebar {
background-color: black;
position: fixed;
width: 300px;
height: 100%;
margin: 0;
}
.sidebar ul {
list-style-type: none;
}
.sidebar li {
color: blue;
}
.sidebar a:hover {
background-color: white;
}
main {
margin: 0 0 0 300px;
}
<!DOCTYPE HTML>
<html>
<head>
<title>Webpage</title>
</head>
<body>
<div class="topwrapper">
<div class="topbar">
<ul>
<li><a style="float: left">Link 1</a></li>
<li><a style="float: left">Link 2</a></li>
<li>
<p style="float: right">Welcome</p>
</li>
</ul>
</div>
</div>
<div class="sidewrapper">
<div class="sidebar">
<ul>
<li><a>Link 3</a></li>
<li><a>Link 4</a></li>
<li>
<p>Welcome</p>
</li>
</ul>
</div>
</div>
<main>
arbitrary text
</main>
</body>
</html>