0

I want the yellow div centered. I need to achieve it using CSS only and not modyfing the layout.

A mandatory requirement is also not to use CSS Positioning Properties or Flex or Grid Loyouts.

Here you have an example page:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Example</title>
  </head>
  <body>
  <style>
    .c {
        background-color:blue;
        text-align:center;
        padding:1em;
    }
    .a {
        background-color:yellow;
        display: inline-block;
        
    }
    .b {
        background-color:lightgreen;
        display: inline-block;
        float:right;
        clear:both;
    }
  </style>
    <div class="c">
        <div class="a"><span>I WANT THIS CENTERED ON BLUE CONTAINER</span></div>
        <div class="b"><span>I LIKE THIS AT RIGHT SIDE OF BLUE CONTAINER</span></div>
    </div>
  </body>
</html>
Javier Haro
  • 1,255
  • 9
  • 14

0 Answers0