我想知道我应该怎么做才能使两列相互浮动。我一直在尝试,找不到任何可以帮助我的东西,非常感谢您的帮助。
* {
box-sizing: border-box;
}
ul {
list-style-type: none;
margin: 0%;
padding: 0%;
overflow: hidden;
background-color:gray;
}
h1 {
font-size: 170%;
}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
background-color: lightsteelblue;
}
/* Create two equal columns that floats next to each other */
.column {
float: left;
width: 50%;
padding: 10px;
height: 300px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/Publikation.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Publikation </title>
</head>
<body>
<h1 align="center">Publikation av webbplatser med och utan webbpubliceringssystem</h1>
<ul>
</ul>
<style>
</style>
<div class="row">
<div class="column" style="background-color: #aaa;">
<h2>column1</h2>
</div>
<div class="column" style="background-color: #bbb;">
<h2>column2</h2>
</div>
</div>
</body>
</html>