search

Home  >  Q&A  >  body text

The css style remains unchanged. If the order of the two div blocks is exchanged, they will be displayed one above the other and cannot be displayed side by side. why is that?

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>4. Two-column layout 2: left body adaptive_right column fixed width</title>

<style type="text/css">

.right {

width: 200px;

height: 600px;

float: right;

background-color: skyblue;

}


.main {

height: 600px;

background-color: cyan;

margin-right:200px;

}

</style>

</head>

<body>

<!-- DOM -->

<div class="main">left_main</div>

<div class="right" >Right side</div>

<!-- The css style remains unchanged. If the order of the two div blocks is exchanged, they will be displayed one above the other and cannot be displayed side by side. Why is this?-->



##</body>

</html>


JojoJojo2074 days ago1380

reply all(2)I'll reply

  • 折断翼的鹰

    折断翼的鹰2019-03-25 09:23:57

    The float you added before: right; just change it to float: left


    reply
    0
  • Cancelreply