首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将自动创建的div水平安排为响应性

将自动创建的div水平安排为响应性
EN

Stack Overflow用户
提问于 2019-08-20 13:27:27
回答 1查看 40关注 0票数 0

我有以下代码:

代码语言:javascript
复制
<div class="bottom-container">
    <div class=bottom-data-cards-content *ngFor="let com of myBottomDataCards"
        (click)="showTagDetail([com.tagname, com.value, com.description, com.units, com.quality, com.timestamp])">
        <div id="textbox">
            <p class="tag-description">{{com.description}}</p>
            <p class="tag-value-units">{{com.value | number : '1.2-2'}} {{com.units}}</p>
        </div>
        <div style="clear: both;"></div>
        <div class=progress-bar-container>
            <div class=tag-lower-limit>{{com.lowlimit | number : '1.0-0'}}</div>
            <div class=progress-bar><meter class="asset-meter" min="{{com.lowlimit | number : '1.0-0'}}"
                    max="{{com.highlimit | number : '1.0-0'}}" low="{{(com.highlimit | number : '1.0-0') * 0.25}}"
                    high="{{(com.highlimit | number : '1.0-0') * 0.75}}"
                    optimum="{{(com.highlimit | number : '1.0-0') * 0.90}}" value="{{com.value}}"></meter>
            </div>
            <div class=tag-higher-limit>{{com.highlimit | number : '1.0-0'}}</div>
        </div>
        <br />
    </div>
</div>

外层的划分如下:

代码语言:javascript
复制
 .bottom-container{
    margin-top:40px;
  }

  .bottom-data-cards-content{
    margin-left:50px;
    flex:1;
    width: 350px;
    cursor: pointer;
    box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.3);
    border-radius:20px;
    padding:0px 10px 0px 10px;
    margin-bottom: 30px;
  }

这将创建5个div,它们垂直对齐,在每个区域之间都有一个空隙。我想把它们水平地排列在桌面上,但垂直地排列在较小的屏幕上。

我该怎么做?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-08-20 13:37:47

请把这个加在样式上。

css

代码语言:javascript
复制
.bottom-container::before,
.bottom-container::after {
    content: "";
    display: table;
    clear: both;
}
.bottom-data-cards-content {
    width: 20%;
    float: left;
    padding: 0px 20px;
}
@media only screen and (max-width: 767px) {
    .bottom-data-cards-content {
        width: 100%;
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57574799

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档