It's quite a challenge to determine the best solution for your specific width without knowing the contents of your inner divs. However, I have some suggestions that may be helpful to you.
Please note: The JsFiddle examples provided below have been modified to include color for better visualization of the positioning effects.
Option One: The Floater
This option involves adding three elements - display, vertical-align, and float to your CSS. This results in the following code:
#container {
height:500px;
width:100%;
text-align: center;
background-color:blue;
display: table-cell;
vertical-align:middle;
}
#div2, #div3 {
float:left;
text-align:center;
width: 50%;
background-color:orange;
}
I will elaborate on why these methods were chosen shortly.
Option Two: Boxception
This option includes margin, display, and vertical-align properties in your CSS:
#container {
height:500px;
width:100%;
text-align: center;
background-color:blue;
display: table-cell;
vertical-align:middle;
}
#div2, #div3 {
margin: 0 auto;
text-align:center;
width: 50%;
background-color:orange;
}
The use of table-cell display along with vertical-align can help position items within the outer div in the center.
The main difference between the first and second options is that the float property may not perfectly center the content vertically, unlike using margin which ensures horizontal centering.
Remember, the width of the div will expand based on its content (meaning it will only appear as a small line if there's no content). Check out this example for clarification.