Cannot make the aside section go to the left

Hi all! I have done a Youtube tutorial from Traversy Media on CSS for beginners and I have this issue:
I cannot make the “main” section go to the right of the page and the “aside/sidebar” go to the left and I cannot understand why since I have done something similar before and it worked…
This is the HTML :

<html>
<head>
	<title>My website</title>
	<link rel="stylesheet" type="text/css" href="mywebsite.css">
</head>

<body>
	<header id="main-header">
		<div class="container">
			<h1>Lavinia's webpage</h1>
		</div>
	</header>
	<nav id="navbar">
		<div class="container">
			<ul>
				<li><a href="#">Home</a> </li>
				<li><a href="#">About</a> </li>
				<li><a href="#">Services</a> </li>
				<li><a href="#">Contact</a> </li>
			</ul>
		</div>
	</nav>
	<section id="showcase">
		<div class="container">
			<h1>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
			tempor incididunt ut labore et dolore magna aliqua.
		    </h1>
		</div>
	</section>
	<div class="container">
	<section id="main">
		<h1>Welcome</h1>
		<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
		tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
		quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
		consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
		cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
		proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
	</section>
	</div>
	<div class="container">
	<aside id="sidebar">
		<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
		tempor incididunt ut labore et dolore magna aliqua. </p>
	</aside>
	</div>
	<footer id="main-footer">
		<p>Copyright &copy 2019</p>
	</footer>
</body>
</html> 


And the CSS : 
body{
	background-color: #660029;
	color: grey;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 16px;
	line-height: 1.4em;
	margin: 0;
}
.container{
	width: 80%;
	margin: auto;
	overflow: hidden;
}
#main-header{
	background-color: #005580;
	color:#ccc;
}
#navbar{
	background-color: grey;
	color: white;
}
#navbar ul{
	padding: 0;
	list-style: none;
}
#navbar li{
	display: inline;
}
#navbar a{
	color: white;
	text-decoration: none;
	padding-right: 45px;
	font-size: 18px;
}
#showcase{
	background-image: url(image/light.jpg);
	background-position: center right;
	min-height: 150px;
	margin-bottom: 30px;
	text-align: center;

}
#showcase h1{
	color: white;
	font-size: 20px;
	line-height: 1.6em;
	padding-top: 30px;
}
#main{
	float: right;
	width: : 70%;
	padding: 10px;
	box-sizing: border-box;
}
#sidebar{
	float: center;
	width: : 30%;
	padding: 10px;
	background:#005580;
	color: white;
	box-sizing: border-box;
	
}
#main-footer{
	background: #005580 ;
	color: white;
	text-align: center;
	padding: 3px;
	margin-top: 30px;
}
@media(max-width: 600px){
	#main{
		width: 100%;
		float: none;
	}
	#sidebar{
		width: 100%;
		float: none;
	}
}

There isn’t a value center for the float property (only left and right). Also, you have double : after the width property for both your sidebar and main id’s.

1 Like

Thank you for the reply. I had not seen the second colon in the width property. It worked now.

1 Like