To achieve a layout with a main section and a sidebar that contains two stacked InfoLists, you can use CSS Flexbox or CSS Grid. Below is an example using Flexbox to create the desired layout.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Infolist Sidebar Layout</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<div class="main-section">
<!-- Main information goes here -->
<h1>Main Information</h1>
<p>This is the main section where the main information is displayed.</p>
</div>
<div class="sidebar">
<div class="info-list status-info">
<!-- Status InfoList goes here -->
<h2>Status Info</h2>
<p>Status details...</p>
</div>
<div class="info-list management-info">
<!-- Management InfoList goes here -->
<h2>Management Info</h2>
<p>Management details...</p>
</div>
</div>
</div>
</body>
</html>
CSS (styles.css)
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
display: flex;
flex-direction: row;
height: 100vh;
}
.main-section {
flex: 3;
padding: 20px;
background-color: #f4f4f4;
}
.sidebar {
flex: 1;
display: flex;
flex-direction: column;
padding: 20px;
background-color: #e4e4e4;
}
.info-list {
flex: 1;
margin-bottom: 20px;
padding: 10px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
}
.info-list:last-child {
margin-bottom: 0;
}
Explanation
-
HTML Structure:
- The
.containerdiv holds both the main section and the sidebar. - The
.main-sectiondiv is for the main content. - The
.sidebardiv contains two.info-listdivs for the status and management information.
- The
-
CSS Styling:
- The
.containerusesdisplay: flexto create a flex container with a row direction. - The
.main-sectiontakes up 3 parts of the available space (flex: 3), while the.sidebartakes up 1 part (flex: 1). - The
.sidebarusesdisplay: flexandflex-direction: columnto stack its children vertically. - Each
.info-listis styled with padding, background color, and border to visually separate them. - The
margin-bottomon.info-listensures there is space between the two lists, except for the last child.
- The
This layout should give you a main section with a sidebar that contains two stacked InfoLists. Adjust the flex values and other styles as needed to fit your specific design requirements.