I have completed the design of a webpage and utilized CSS for positioning elements. The current layout consists of a Header, Horizontal Menu, and a Content Section with 2 columns, all of which are set to the same width.
Although I have successfully aligned them to the left, my goal is to center these sections on the page.
To achieve this, I have introduced a DIV called 'full' to encapsulate the other DIVs. While I managed to center the Header and Menu using CSS code: margin: 0 auto; within their respective IDs, I encountered an issue with the Content ID remaining aligned to the left.
When attempting to float the content section either left or right, it ends up off-center in the corresponding direction. Removing the float option entirely results in the content section's background blending with the body background.
Upon inspecting using a debugger, it seems that the Body and #full span across the width of the page but only vertically cover the header and menu sections. I am unsure of the reason behind this behavior.
My assumption is that I need to incorporate a "clear" somewhere in the code, although the exact placement eludes me. I experimented with a 'clear: both' declaration in the #menuBar without success.
Any assistance provided would be immensely valuable.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8>
<title>My First Practice Page</title>
<style>
#content {
background-color: #eee;
float: left;
}
body {
background-color: silver;
}
...
... [Remaining HTML and CSS content]
...