有没有办法用 css 实现这种交错的气泡布局,我什至不知道从哪里开始
is there a to a achieve this sort of staggered bubble layout with css, i'm unable to know where to even start from
我正在努力实现这个精确的设计,但不知道如何实现它,是使用网格还是 flex。内容也将动态呈现,我避免对其进行硬编码
在下面的代码中,我发布了 html 和 css,您可以将它们用于类似于图片的样式:
body {
padding: 0;
margin: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.parentAll {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
width: 80%;
margin: 0 auto;
/* width: 1000px;*/
}
.parentAll:nth-child(2) {
width: 100%;
}
.parentAll div {
width: 220px;
text-align: center;
line-height: 100px;
height: 220px;
font-size: 2rem;
background-color: #135d21;
color: white;
border-radius: 50%;
}
.parentAll div.active {
color: #101000;
background-color: #d79d25;
}
@media only screen and (max-width: 1200px) {
.parentAll div {
width: 170px;
height: 170px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>circles</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section class="parentAll">
<div>div1</div>
<div class="active">div2</div>
<div>div3</div>
<div>div4</div>
</section>
<section class="parentAll">
<div>div5</div>
<div>div6</div>
<div>div7</div>
<div>div8</div>
<div>div9</div>
</section>
<section class="parentAll">
<div>div10</div>
<div>div11</div>
<div>div12</div>
<div>div13</div>
</section>
</body>
</html>
你可以玩弄“.parentAll div”的“宽度”和“高度”,以获得适合你的尺寸和不同的屏幕尺寸。
要动态呈现内容,您可以使用 javascript 或 vue 或其他与圆圈样式无关的选项。
我正在努力实现这个精确的设计,但不知道如何实现它,是使用网格还是 flex。内容也将动态呈现,我避免对其进行硬编码
在下面的代码中,我发布了 html 和 css,您可以将它们用于类似于图片的样式:
body {
padding: 0;
margin: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.parentAll {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
width: 80%;
margin: 0 auto;
/* width: 1000px;*/
}
.parentAll:nth-child(2) {
width: 100%;
}
.parentAll div {
width: 220px;
text-align: center;
line-height: 100px;
height: 220px;
font-size: 2rem;
background-color: #135d21;
color: white;
border-radius: 50%;
}
.parentAll div.active {
color: #101000;
background-color: #d79d25;
}
@media only screen and (max-width: 1200px) {
.parentAll div {
width: 170px;
height: 170px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>circles</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section class="parentAll">
<div>div1</div>
<div class="active">div2</div>
<div>div3</div>
<div>div4</div>
</section>
<section class="parentAll">
<div>div5</div>
<div>div6</div>
<div>div7</div>
<div>div8</div>
<div>div9</div>
</section>
<section class="parentAll">
<div>div10</div>
<div>div11</div>
<div>div12</div>
<div>div13</div>
</section>
</body>
</html>
你可以玩弄“.parentAll div”的“宽度”和“高度”,以获得适合你的尺寸和不同的屏幕尺寸。
要动态呈现内容,您可以使用 javascript 或 vue 或其他与圆圈样式无关的选项。