Can someone help me with a CSS and DIV tags issue? I have a dynamic webpage and need guidance on creating a container DIV. Depending on the scenario, this container DIV will either hold one DIV with 50% width that needs to be centered or two side-by-side DIVs each taking up 50% width.
I've attempted using float:center and overflow:hidden, which works for a single DIV but not for two as they stack vertically. When I use float:left, the two DIVs display correctly but the single DIV is aligned to the left instead of centered.
If anyone has suggestions on how to achieve this layout effectively, I would greatly appreciate it!
<div style="width:800px; margin: 2px; background-color:blue">
<div style="width:50%; background-color:orange;">
Text
</div>
<div style="width:50%; background-color:red;">
Text
</div>
</div>