本文介绍了是否可以在引导列中设置背景以放大div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写下一个示例:

I need to code the next example:

我正在使用引导程序对所有网站进行编码,本节的代码如下:

I'm coding all website using bootstrap and the code of this section is this:

`<div class="bg_blue">
        <div class="container">
            <!-- Example row of columns -->
            <div class="row">
                <div class="col-md-6">
                    <div id="login-form-box" class="form-box">
                        <div id="login-form-info" class="form-info">
                            <?php if (isset($content['info']) && !empty($content['info'])) {
                            echo $content['info'];
                            }
                            ?>
                        </div>
                        <?php if (isset($error_message)) {
                        echo '<div id="login-form-info" class="form-error">'.$error_message.'</div>';
                        }
                        ?>
                        <form id="login-form" class="form" action="<?php echo api_get_path(WEB_PATH)?>index.php" method="post">
                            <div>
                                <label for="login"><?php echo custompages_get_lang('User');?></label>
                                <input name="login" type="text" /><br />
                                <label for="password"><?php echo custompages_get_lang('Password');?></label>
                                <input name="password" type="password" /><br />
                            </div>
                        </form>
                        <div id="login-form-submit" class="form-submit" onclick="document.forms['login-form'].submit();">
                            <span><?php echo custompages_get_lang('LoginEnter');?></span>
                            </div> <!-- #form-submit -->
                            <div id="links">
                                <?php if (api_get_setting('allow_registration') === 'true') { ?>
                                <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/inscription.php?language=<?php echo api_get_interface_language(); ?>">
                                    <?php echo custompages_get_lang('Registration')?>
                                </a><br />
                                <?php } ?>
                                <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/lostPassword.php?language=<?php echo api_get_interface_language(); ?>">
                                    <?php echo custompages_get_lang('LostPassword')?>
                                </a>
                            </div>
                        </div>
                    </div>
                <div class="col-md-6">
                    <!-- <img class="img" src="<?php echo api_get_path(WEB_PATH)?>/custompages/images/bgimage.png" alt="Background" /> -->
                </div>
            </div> <!-- /row -->
        </div><!-- /container -->
    </div>`

问题是我无法将图像背景设置为调整大小的第二列,并覆盖了右侧的md-6列中的全部内容.

The problem is that I cant set the image background to the second column that resizes and that covers the full with out of the column-md-6 to the right.

这是一个小草图:

推荐答案

已更新2018年

Updated 2018

Bootstrap 4 ,概念仍然相同: https://www.codeply.com/go/ffaQgse2SU

我已经回答了类似的问题,但是您的答案是因为background-image有点不同.我发现最好的方法是使用CSS伪元素,因为它会与col-md-6一起调整,因此可以响应.

I have answered similar questions on this, but yours is a little different because the background-image. The best way I've found is using a CSS pseudo element becuase it adjusts along with right col-md-6 and therefore works responsively.

Bootstrap 3演示: http://www.codeply.com/go/rWOGi4LrU1

Bootstrap 3 Demo: http://www.codeply.com/go/rWOGi4LrU1

.right {
    z-index: 0;
    color: #fff;
}

.right:before {
    background-image:url(..);
    content: '';
    display: block;
    position: absolute;
    z-index: -1;
    width: 999em;
    /* allow for bootstrap column padding */
    top: -15px;
    left: -15px;
    bottom: -15px;
}

演示

另请参阅:获取具有不同背景的两列延伸到屏幕边缘的颜色

这篇关于是否可以在引导列中设置背景以放大div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 20:34