Добавление нескольких левой и правой боковой панели рядом с каждым с помощью flexbox - PullRequest
0 голосов
/ 23 ноября 2018

На самом деле я пытался разобраться в этом сам, но я не могу понять это, я создал макет, используя flexbox, но я пытаюсь достичь чего-то.Позвольте мне заявить: - У меня есть заголовок, навигация и раздел из трех столбцов, который включает в себя, основной раздел и две боковые панели слева и справа, и я хочу добавить больше боковой панели на правой боковой панели, но я не могу понять этотак как вы знаете, что я уже объявил три столбца flex ...

Вы можете проверить изображение здесь, чтобы понять, что я пытаюсь достичь U can check the image here for understand what am trying to achieve

Исходный кодздесь www.codepen.io/enipx/details/dQmXKP

Ответы [ 2 ]

0 голосов
/ 23 ноября 2018

Обновленный Codepen здесь Идея состоит в том, чтобы обернуть макет колонки flexbox внутри правой боковой панели.

/* ===== Framework ===== */

html{
	box-sizing: border-box;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	-ms-box-sizing: border-box;
	-o-box-sizing: border-box;
}

*, *::before, *::after{
	box-sizing: inherit;
}

body{
	background-color: #fdfafb;
	height: 100vh;
	/* border: 1px solid green; */
	margin: 0 auto;
	width: 100%;
}

.col-1{
	width: 8.33%;
}
.col-2{
	width: 16.66%;
}
.col-3{
	width: 25%;
}
.col-4{
	width: 33.33%;
}
.col-5{
	width: 41.66%;
}
.col-6{
	width: 50%;
}
.col-7{
	width: 58.33%;
}
.col-8{
	width: 66.66%;
}
.col-9{
	width: 75%;
}
.col-10{
	width: 83.33%;
}
.col-11{
	width: 91.66%;
}
.col-12{
	width: 100%	;
}


/* ===== Layout ===== */

#header{
	margin: 10px;
	height: 90px;
	border-radius: 5px 5px 0 0;
	background-color: rgba(160,194,227,0.8);
	text-align: center;
	color: white;
	font-size: medium;
}

#nav{
	margin: 10px;
	margin-top: 0;
	height: 40px;
	border-radius: 0;
	background-color: rgba(160,194,227,0.3);
	text-align: center;
	color: white;
	font-size: medium;
}

.mainparent{
	display: flex;
}

.sidebarright{
	border-radius: 0;
	text-align: center;
	color: white;
	font-size: medium;
	flex-basis: 16%;
	order: 1;
}

.column {
  display: flex;
  flex-direction: column;
}

.column .top,
.column .bottom {
  	margin: 10px;
	margin-top: 0;
  flex-basis: 100%;
  max-width: 100%;
    height: 195px;
    background-color: rgba(160,194,227,0.8);
}


.sidebarleft{
	margin: 10px;
	margin-top: 0;
	border-radius: 0;
	background-color: rgba(160,194,227,0.5);
	text-align: center;
	color: white;
	font-size: medium;
	flex-basis: 16%;
	order: -1;
	height: 400px;
}

.main{
	margin-bottom: 10px;
	margin-top: 0;
	margin-right: 0;
	margin-left: 0;
	border-radius: 0;
	background-color: rgba(160,194,227,0.5);
	text-align: center;
	color: white;
	font-size: medium;
	flex-basis: 68%;
	height: 400px;
}

.imgport{
	display: flex;
	flex-wrap: wrap;
}

.imgport img {
	width: calc(25% - 20px);
	height: 200px;
	margin: 10px;
	margin-top: 0;
	opacity: 0.8;
	transition: 0.5s ease-in-out;
}

.imgport img:hover {
	opacity: 1.0;
}

#footer{
	margin: 10px;
	margin-top: 0;
	height: 200px;
	border-radius: 0 0 5px 5px;
	background-color: rgba(160,194,227,0.8);
	text-align: center;
	color: white;
	font-size: medium;
}
<!DOCTYPE html>
<html>
<head>
	<title>Layout</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width" initial-scale="1.0">
	<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>

	<header id="header">
		header
	</header>

	<nav id="nav">
		nav
	</nav>

	<div class="mainparent">
		<aside class="sidebarright">
      <div class="column">
        <div class="top">sidebarright top</div>
        <div class="bottom">sidebarright bottom</div>
      </div>
		</aside>

		<aside class="sidebarleft">
			sidebarleft
		</aside>

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

	<div class="imgport">
    
		<img src="https://images.unsplash.com/photo-1536276502222-b10f42bcf71e?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=6266a66ab254251150d738aad585fd36" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1538592716926-9a321f0614ea?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=488b23073a233d23083f36b67c3bd769" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1506798161991-ff979d14a391?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=7378c40e370c1207c6bca0d269c81818" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1537203626302-cb08b9deb186?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=224379104368ef8280a06dfedda5c01b" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1534256007535-8692ac6876cf?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=4c0f4f5d14175406c0ab97a8a0700950" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1521405785232-7a56b029191e?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=c15f44bf62d0a5307c50150953fea8deg" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1521405785232-7a56b029191e?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=c15f44bf62d0a5307c50150953fea8de" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1534256007535-8692ac6876cf?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=4c0f4f5d14175406c0ab97a8a0700950" alt="boxes">
	</div>

	<footer id="footer">
		footer
	</footer>

</body>
</html>
0 голосов
/ 23 ноября 2018

Вы можете обернуть две боковые панели в правый div .sidebarright

/* ===== Framework ===== */

html{
	box-sizing: border-box;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	-ms-box-sizing: border-box;
	-o-box-sizing: border-box;
}

*, *::before, *::after{
	box-sizing: inherit;
}

body{
	background-color: #fdfafb;
	height: 100vh;
	/* border: 1px solid green; */
	margin: 0 auto;
	width: 100%;
}

.col-1{
	width: 8.33%;
}
.col-2{
	width: 16.66%;
}
.col-3{
	width: 25%;
}
.col-4{
	width: 33.33%;
}
.col-5{
	width: 41.66%;
}
.col-6{
	width: 50%;
}
.col-7{
	width: 58.33%;
}
.col-8{
	width: 66.66%;
}
.col-9{
	width: 75%;
}
.col-10{
	width: 83.33%;
}
.col-11{
	width: 91.66%;
}
.col-12{
	width: 100%	;
}


/* ===== Layout ===== */

#header{
	margin: 10px;
	height: 90px;
	border-radius: 5px 5px 0 0;
	background-color: rgba(160,194,227,0.8);
	text-align: center;
	color: white;
	font-size: medium;
}

#nav{
	margin: 10px;
	margin-top: 0;
	height: 40px;
	border-radius: 0;
	background-color: rgba(160,194,227,0.3);
	text-align: center;
	color: white;
	font-size: medium;
}

.mainparent{
	display: flex;
}

.sidebarright{
	flex-basis: 16%;
	order: 1;
}

.sidebarrightfirst{
	margin: 10px;
	margin-top: 0;
	border-radius: 0;
	background-color: rgba(160,194,227,0.5);
	text-align: center;
	color: white;
	font-size: medium;
	height: 195px;
}

.sidebarrightsecond{
	margin: 10px;
	margin-top: 0;
	border-radius: 0;
	background-color: rgba(160,194,227,0.5);
	text-align: center;
	color: white;
	font-size: medium;
	height: 195px;
}

.sidebarleft{
	margin: 10px;
	margin-top: 0;
	border-radius: 0;
	background-color: rgba(160,194,227,0.5);
	text-align: center;
	color: white;
	font-size: medium;
	flex-basis: 16%;
	order: -1;
	height: 400px;
}

.main{
	margin-bottom: 10px;
	margin-top: 0;
	margin-right: 0;
	margin-left: 0;
	border-radius: 0;
	background-color: rgba(160,194,227,0.5);
	text-align: center;
	color: white;
	font-size: medium;
	flex-basis: 68%;
	height: 400px;
}

.imgport{
	display: flex;
	flex-wrap: wrap;
}

.imgport img {
	width: calc(25% - 20px);
	height: 200px;
	margin: 10px;
	margin-top: 0;
	opacity: 0.8;
	transition: 0.5s ease-in-out;
}

.imgport img:hover {
	opacity: 1.0;
}

#footer{
	margin: 10px;
	margin-top: 0;
	height: 200px;
	border-radius: 0 0 5px 5px;
	background-color: rgba(160,194,227,0.8);
	text-align: center;
	color: white;
	font-size: medium;
}
<header id="header">
		header
	</header>

	<nav id="nav">
		nav
	</nav>

	<div class="mainparent">

        
    <div class="sidebarright">
      <aside class="sidebarrightfirst">
			sidebarright
		</aside>
      <aside class="sidebarrightsecond">
			sidebarright
		</aside>
    </div>
    
		<aside class="sidebarleft">
			sidebarleft
		</aside>

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

	<div class="imgport">
    
		<img src="https://images.unsplash.com/photo-1536276502222-b10f42bcf71e?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=6266a66ab254251150d738aad585fd36" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1538592716926-9a321f0614ea?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=488b23073a233d23083f36b67c3bd769" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1506798161991-ff979d14a391?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=7378c40e370c1207c6bca0d269c81818" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1537203626302-cb08b9deb186?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=224379104368ef8280a06dfedda5c01b" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1534256007535-8692ac6876cf?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=4c0f4f5d14175406c0ab97a8a0700950" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1521405785232-7a56b029191e?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=c15f44bf62d0a5307c50150953fea8deg" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1521405785232-7a56b029191e?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=c15f44bf62d0a5307c50150953fea8de" alt="boxes">
    
		<img src="https://images.unsplash.com/photo-1534256007535-8692ac6876cf?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=4c0f4f5d14175406c0ab97a8a0700950" alt="boxes">
	</div>

	<footer id="footer">
		footer
	</footer>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...