Is it possible to set a background in the boot column that increases the size of the div?

I need to encode the following example:

enter image description here

I encode the whole site using bootstrap, and the code for this section is as follows:

`<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>`

The problem is that I cannot set the background of the image to the second column, which resizes and covers the full text from column-md-6 to the right.

Here is a little sketch:

enter image description here

0
source share
3 answers

If you want to target only average screen sizes , you can do this as follows. give width: 120%your element img and it will overflow and take the full size on the left.

working fragment

.img {
  width: 120%;
}

.col-md-6 {
  background-color: green;
}
<html>

<head>
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

</head>

<body>
  <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">

            </div>

            <form id="login-form" class="form" action="" method="post">
              <div>
                <label for="login"></label>
                <input name="login" type="text" /><br />
                <label for="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></span>
            </div>
            <!-- #form-submit -->
            <div id="links">

              <a href="">

              </a><br />

              <a href="">

              </a>
            </div>
          </div>
        </div>
        <div class="col-md-6">
          <img class="img" src="https://www.w3schools.com/css/trolltunga.jpg" alt="Background" />
        </div>
      </div>
      <!-- /row -->
    </div>
    <!-- /container -->
  </div>
</body>

</html>
Run codeHide result

Note:

, col-lg-* col-xs-* col-sm-* i.e .

, !

+2

2018

Bootstrap 4, : https://www.codeply.com/go/ffaQgse2SU

, background-image. , , - CSS, col-md-6 .

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;
}

: ,

+1

I finally did this by removing the container div.

Now I am having a big problem in a mobile device that the background image is lost on mobile devices.

http://www.thalescampusvirtual.com/index.php

-1
source

Source: https://habr.com/ru/post/1668623/


All Articles