css - 如何在一个div中包含一个div?

标签 css

我有 2 列,50% 和 50% 我想包含 Slick Slider在左边然后是消息和右边的按钮。 但我不知道如何包含 Slick Slider,请帮忙。

Picture

下面的部分是我正在修复的,它应该像上面的那样

这是我的代码:
section-events.jade:

section.events
    .flex.flex--center
        .col-50
            .single-item
                .item.item1 item 1
                .item.item2 item 2
                .item.item3 item 3
                .item.item4 item 4

        .col-50.flex.flex--center
            .col-1
                .desc-wrap
                    p.home-lead.outdented ...Current news and events...
                    a(href="").home-cta See All News

风格.sass:

.flex
    display: flex

.flex--center
    justify-content: center

.col-1
width: 320px
padding: 0 10px
box-sizing: border-box

.col-50
width: 50% 

@media (max-width: 640px)

.col-1
    width: 100%

.col-50
    width: auto

section-events.sass

section.events
    background:
        image: url(../img/events-bg.jpg)
        position: center
        size: cover

    .home-lead
        color: white

    .home-sections &
        padding: 0

        @media (max-width: 640px)
            padding-bottom: 50px

    .col-1
        display: flex
        align-items: center

        @media (max-width: 640px)
            display: block

    .home-cta
        color: white
        background: #F06292

    .col-50
        .single-item
            width: 50%
            position: absolute

            .item
                width: 100%
                height: 100%
                text-align: center
                line-height: 300px
                color: white
                font-size: 30px

            .item1
                background:
                    image: url(../img/events-bg.jpg)
                    position: center
                    size: cover

            .item2
                background:
                    image: url(../img/academics-bg.jpg)
                    position: center
                    size: cover

            .item3
                background:
                    image: url(../img/about-bg.jpg)
                    position: center
                    size: cover

            .item4
                background:
                    image: url(../img/events-bg.jpg)
                    position: center
                    size: cover

最佳答案

  .col-1
  width: 100%  

应该是 50% 并且在其他任何地方都出现 .col-1

关于css - 如何在一个div中包含一个div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35787190/

相关文章:

html - HTML 中是否有(或将有)图像 Sprite 语法?

jQuery抓取图像的高度来检查是否一定高度

html - 移动站点的图像大小调整,Ruby on rails

javascript - 如何通过 grunt & jasmine 设置 PhantomJS 的视口(viewport)大小?

html - 将 PSD 切片为 CSS+HTML 输出的好工具

html - 第 n 个 child (偶数)总是选择 dd,从不选择 dt(dl 中的偶数和奇数行)

html - 具有流动宽度和高度的列

html - Electron :模态和自定义菜单栏的问题

转换时的 HTML 文本对齐问题

html - div居中的定位问题