如何设置子div不与父div相关

时间:2017-09-20 08:34:31

标签: html css

我想在帖子上插入表格HTML。

<div class="page-section">
    <div class="container">
        <div class="row">
            <div class="col-md-1"></div>
            <div class="col-md-10">
                {!! $post->body !!}
            </div>
            <div class="col-md-1"></div>
        </div>
    </div>
</div>

.page-section的CSS:

.page-section {
    display: block;
    position: relative;
    overflow: hidden;
}

表格代码:

li {
  list-style: none;
}
/* ------------ pricing table -------------- */

#pricing-table-section .pricing-table {
    border: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    -webkit-transition: all 400ms linear;
    transition: all 400ms linear;
    padding: 32px 21px;
    border-radius: 8px;
    background: #f5f5f5;
}

#pricing-table-section .pricing-table h4 {
    color: #74a534;
    font-family: "Roboto", sans-serif;
    margin-bottom: 25px;
}

#pricing-table-section .pricing-table .price {
    padding: 22px 0;
    border-top: 1px solid #e1f1ff;
    /* border-bottom: 1px solid #d9d9d9; */
}

#pricing-table-section .pricing-table .price h2 {
    margin-left: 20px;
    position: relative;
    font-family: 'Open Sans', sans-serif;
    color: #000000;
}

#pricing-table-section .pricing-table .price h2 span {
    font-family: "Roboto", sans-serif;
}

#pricing-table-section .pricing-table .price h2 .dollar {
    font-size: 18px;
    display: inline-block;
    position: absolute;
    /* left: -20px; */
    top: 10px;
}

#pricing-table-section .pricing-table .price h2 .month {
    font-size: 10px;
    display: inline-block;
    position: absolute;
    left: 9px;
    bottom: -4px;
    color: #929292;
}

@media screen and (max-width: 992px) {
    #pricing-table-section .pricing-table .price h2 {
        margin-left: 10px;
    }
}

#pricing-table-section .pricing-table .price p {
    color: #929292;
}

#pricing-table-section .pricing-table ul.packages {
    padding: 20px 0;
}

#pricing-table-section .pricing-table ul.packages li {
    font-size: 16px;
    font-weight: 400;
    font-family: "Open Sans", sans-serif;
    line-height: 40px;
}

#pricing-table-section .pricing-table ul.packages li i {
    display: inline-block;
    width: 24px;
    color: #62be10;
}

#pricing-table-section .pricing-table .button {
    background: #07aaa5;
    color: #ffffff;
    border-color: transparent;
}


/* #pricing-table-section .pricing-table .button:before {
    background: #74a534;
} */

#pricing-table-section .pricing-table.black {
    background: #07aaa5;
    color: #ffffff;
    border-color: transparent;
}

#pricing-table-section .pricing-table.black ul.packages li i,
#pricing-table-section .pricing-table.kinhdoanh ul.packages li i,
#pricing-table-section .pricing-table.coban ul.packages li i {
    color: #ffffff;
}

#pricing-table-section .pricing-table.black h4,
#pricing-table-section .pricing-table.black h2,
#pricing-table-section .pricing-table.black p,
#pricing-table-section .pricing-table.black h2>.month {
    color: #ffffff;
}

#pricing-table-section .pricing-table.black .button {
    background: #ffffff;
    color: #202125;
}

#pricing-table-section .pricing-table.black .button:before {
    background: #74a534;
}

#pricing-table-section .pricing-table.black .button:hover,
#pricing-table-section .pricing-table.black .button:focus,
#pricing-table-section .pricing-table.black .button:active {
    color: #ffffff;
}

@media screen and (max-width: 767px) {
    #pricing-table-section .pricing-table.black {
        margin: 50px 0;
    }
}

#pricing-table-section .pricing-table.black:hover .button:before,
#pricing-table-section .pricing-table.coban:hover .button:before,
#pricing-table-section .pricing-table.kinhdoanh:hover .button:before {
    background: #202125;
}

#pricing-table-section .pricing-table:hover .button:hover {
    color: #ffffff;
}


/* ------------ pricing table  end -------------- */
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div id="pricing-table-section" class="mid-level-padding">
    <div class="container">
        <div class="row">
            <div class="col-xs-12 text-center ">
                <div class="section-top-heading">
                    <h2 class="head-content">Bảng giá</h2>
                    <p>Tùy theo nhu cầu của bạn và chọn gói tốt nhất cho mình.</p>
                </div>
            </div>

        </div>
        <div class="row">
            <div style="margin-bottom:10px;" class="col-lg-4 col-md-4 col-sm-6 col-xs-12 wow fadeInLeft animated" style="visibility: visible;">
                <div class="pricing-table coban">
                    <div class="type">
                        <h4>Gói cơ bản</h4>
                    </div>
                    <div class="price">
                        <div class="row">
                            <div class="col-xs-12">
                                <h2>2.200.000 <span class="dollar">VNĐ</span></h2>
                                <span style="margin-left: 20px;">Thiết kế web theo mẫu sẵn có</span>
                            </div>
                        </div>
                    </div>
                    <div class="underline1 normal no-margin"></div>
                    <div class="underline2 normal no-margin"></div>
                    <ul class="packages">
                        <li><i class="fa fa-check" aria-hidden="true"></i>Chọn mẫu giao diện</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i><strong>Miễn phí</strong> 1 hosting + tên miền</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i>Hỗ trợ 24/7</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i>Bảo hành vĩnh viễn</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i>Chức năng đặt hàng, thanh toán</li>
                    </ul>
                    <button class="btn button btn-block"><a href="/goi-co-ban"> Xem Mẫu Web </a></button>
                </div>
            </div>
            <div style="margin-bottom:10px;" class="col-lg-4 col-md-4 col-sm-6 col-xs-12 wow fadeInUp animated" data-wow-duration="3s" style="visibility: visible; animation-duration: 3s;">
                <div class="pricing-table black">
                    <div class="type">
                        <h4>Gói theo yêu cầu</h4>
                    </div>
                    <div class="price">
                        <div class="row">
                            <div class="col-xs-12">
                                <h2>3.500.000+ <span class="dollar">VNĐ</span></h2>
                                <span style="margin-left: 20px;">Web giới thiệu công ty, sản phẩm.</span>
                            </div>
                        </div>
                    </div>
                    <div class="underline1 normal no-margin"></div>
                    <div class="underline2 normal no-margin"></div>
                    <ul class="packages">
                        <li><i class="fa fa-check" aria-hidden="true"></i><strong>Thiết kế web theo yêu cầu</strong></li>
                        <li><i class="fa fa-check" aria-hidden="true"></i><strong>Miễn phí</strong> 1 hosting + tên miền</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i>Hỗ trợ 24/7</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i>Bảo hành vĩnh viễn</li>
                        <li><i class="fa fa-times" aria-hidden="true"></i>Không hỗ trợ đặt hàng, thanh toán</li>
                    </ul>
                    <button onclick="location.href='http://127.0.0.1:8000/#contact-us'" class="btn button btn-block">Đăng ký</button>
                </div>
            </div>
            <div style="margin-bottom:10px;" class="col-lg-4 col-md-4 col-sm-6 col-xs-12 col-md-offset-0 col-lg-offset-0 col-xs-offset-0 col-sm-offset-3 wow fadeInRight animated" style="visibility: visible;">
                <div class="pricing-table kinhdoanh">
                    <div class="type">
                        <h4>Gói kinh doanh</h4>
                    </div>
                    <div class="price">
                        <div class="row">
                            <div class="col-xs-12">
                                <h2>4.200.000+ <span class="dollar">VNĐ</span></h2>
                                <span style="margin-left: 20px;">Website bán hàng.</span>
                            </div>
                        </div>
                    </div>
                    <div class="underline1 normal no-margin"></div>
                    <div class="underline2 normal no-margin"></div>
                    <ul class="packages">
                        <li><i class="fa fa-check" aria-hidden="true"></i><strong>Thiết kế web theo yêu cầu</strong></li>
                        <li><i class="fa fa-check" aria-hidden="true"></i><strong>Miễn phí</strong> 1 hosting + tên miền</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i>Hỗ trợ 24/7</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i>Bảo hành vĩnh viễn</li>
                        <li><i class="fa fa-check" aria-hidden="true"></i><strong>Chức năng đặt hàng, thanh toán</strong></li>
                    </ul>
                    <button class="btn button btn-block">Đăng ký</button>
                </div>
            </div>
        </div>

    </div>
</div>
<!--pricing table end -->

$post->body上包含此表HTML。

我希望表格HTML应位于中心页面。

但它在.page-section .container内有位置。

我可以在表格HTML中添加类和样式。有没有任何方法可以改变这个表,这个表不依赖于父div?

当前我的表格HTML如下:

说明:

在文字上,您可以看到尺寸相等。

我希望HTML表格的维度也相等。

但div中的HTML表包含文本。

2 个答案:

答案 0 :(得分:1)

删除表div.container中的#pricing-table-section。它将被修复。

答案 1 :(得分:0)

从你正在分享的屏幕截图来看,桌子似乎正在溢出容器。

您可以尝试添加widthtable-layout: fixed,例如:

#pricing-table-section .pricing-table {
    border: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    -webkit-transition: all 400ms linear;
    transition: all 400ms linear;
    padding: 32px 21px;
    border-radius: 8px;
    background: #f5f5f5;

    table-layout: fixed; 
    width: 100%
}
相关问题