How can I center a span element within a container div when the span is preceded by another div? Here's my current code:
<div id="container">
<div id="a">A</div>
<span id="b">B</span>
</div>
#container {
display:flex;
background-color:#0AA;
text-align:center;
}
#a {
width:70%;
background-color:#AA0;
}
You can also view this on jsfiddle: http://jsfiddle.net/pbek7av3/1/
I've tried using text-align:center and margin:auto, but unfortunately, these methods are not working for me. Any other suggestions?
Update: I've considered an alternative approach which you can view here: http://jsfiddle.net/pbek7av3/2/ Is there a way to make div B take up the remaining space in the parent container with something like width:auto;?