【发布时间】:2015-04-30 00:36:20
【问题描述】:
我今天从我们的设计师那里得到了一份 PSD,其布局如下:
他们希望包含 3 个均匀分布的圆圈,它们也必须具有响应性。到目前为止,我尝试过的所有解决方案都失败了。
我现在的代码如下:
CSS(从 SCSS 编译)
.section2 .info-box {
float: left;
display: block;
margin-right: 10.1484%;
width: 26.56773%; }
/* line 89, /Users/chriswatson/.rvm/gems/ruby-2.1.5/gems/neat-1.7.2/app/assets/stylesheets/grid/_span-columns.scss */
.section2 .info-box:last-child {
margin-right: 0; }
@media screen and (max-width: 992px) {
/* line 84, /Users/chriswatson/Sites/nuvi-website/source/stylesheets/index.css.scss */
.section2 .info-box {
float: left;
display: block;
margin-right: 38.19821%;
width: 100%;
margin-bottom: 40px;
background-color: rgba(250, 250, 250, 0.1);
padding: 15px; }
/* line 89, /Users/chriswatson/.rvm/gems/ruby-2.1.5/gems/neat-1.7.2/app/assets/stylesheets/grid/_span-columns.scss */
.section2 .info-box:last-child {
margin-right: 0; } }
/* line 94, /Users/chriswatson/Sites/nuvi-website/source/stylesheets/index.css.scss */
.section2 .info-box img {
height: 90px;
margin-bottom: 20px; }
/* line 99, /Users/chriswatson/Sites/nuvi-website/source/stylesheets/index.css.scss */
.section2 .info-box h2 {
font-size: 1.2em; }
/* line 103, /Users/chriswatson/Sites/nuvi-website/source/stylesheets/index.css.scss */
.section2 .info-box p {
font-size: 18px; }
HTML
<div class="full-width">
<h1>A Comprehensive Solution</h1>
<div class="info-box">
<div class="circle">
<img src="/images/timer.png" alt="timer" />
<h2>Real-Time</h2>
<p>NUVI monitors 12 social networks and nearly 4 million RSS feeds in over 20 languages in Real Time.</p>
<button class="learn-more">Learn More</button>
</div>
</div>
<div class="info-box themiddleone">
<div class="circle">
<img src="/images/multi-monitors.png" alt="monitors" />
<h2>Visualizations</h2>
<p>Beautiful visualizations and dashboards make it easy to see actionable insights.</p>
<button class="learn-more">Learn More</button>
</div>
</div>
<div class="info-box">
<div class="circle">
<img src="/images/server.png" alt="server" />
<h2>Reporting</h2>
<p>Beautiful visualizations and dashboards make it easy to see actionable insights.</p>
<button class="learn-more">Learn More</button>
</div>
</div>
</div>
我怎样才能让这些圆圈如上图所示?
【问题讨论】:
-
也许您可以详细说明如何您希望它响应?
-
在这种情况下,特别是如果您收到 PSD 格式的设计并希望与旧版浏览器兼容,我通常建议使用圆圈的图像。我会让它们成为一个只有圆圈本身的背景图像,其他一切都是透明的
-
使用弹性盒子和
justify-content: space-around。 -
这不是纯 CSS BTW。要么发布 CSS,要么用 less、sass 或其他任何东西更新问题标签。
-
@mascaliente 检查此 SO 链接。 stackoverflow.com/questions/12945891/responsive-css-circles/…
标签: javascript jquery html css