I'm having a lot of trouble with this, given the following HTML:
<!doctype html>
<head>
<style>
.nav {
width: 26%;
display: inline;
float: left;
margin-left: 2%;
margin-right: 2%;
background-color: #FF0000;
}
.content {
width: 56%;
display: inline;
float: left;
margin-left: 2%;
margin-right: 2%;
background-color: #0000FF;
}
</style>
</head>
<body>
<div style="width: 600px;">
<div class="nav"><p>nav</p></div>
<div class="content"><p>content</p></div>
</div>
</body>
</html>
I get the following (expected) output:
However, if I change the div
element with the class = nav
to this:
<div class="nav"></div>
I get this (not expected and undesirable) output:
It's like there is no div there! How can I get the following output:
Surely there must be a simple way to do this, no?