0

For the two orange div boxes in this code look a bit awkward. The right div's margin is slightly narrower than the left div's. How do I fix this?

CSS:

    html {font-size: 1em;}
body {margin: 0; padding: 0;}

.row,
.column {
    box-sizing: border-box;
}
div.box {
        background-color: rgba(230, 126, 34,1);
        width: 37em;
        padding: 2em 0;
        margin-left: 2em;
        margin-top: 2em;
        text-align: center;
        display: inline-block;


.container {
    background-color: slategrey;
    width: 100%;
    height: 72em;

1 Answer 1

1

I think its because of the inline: block try to change it to float: left;

div.box {
    background-color: rgba(230, 126, 34,1);
    width: 37em;
    padding: 2em 0;
    margin-left: 2em;
    margin-top: 2em;
    text-align: center;
  //display: inline-block;
    float: left;

}
Sign up to request clarification or add additional context in comments.

1 Comment

I thought display: inline-block can replace float: left

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.