简体   繁体   中英

How to put a background image on a Bootstrap form?

I'm trying to put a background image on my form (like behind the text and inputs, just like a background image of my web site), using the Bootstrap framework but the image appears at the bottom and I want it inside the "container".

My code is something like this:

<div class="container">
    <div class="thumbnail">
        <form....>
            <fieldset>
            .
            .
            .
        </form>
        <img src="cs.jpg" class="img-responsive">
    </div>
<div>

Have you tried setting the background image of that container as the image? IE:

.container {
    background-image: url("cs.jpg");
}

Or you can do it inline:

<div class="container" style="background-image: url('cs.jpg');">
    ...
</div>

or you could try like this..

<body>
    <div class="jumbotron">
    <div class="container">
        <h1>Hello, world!</h1>
        <p>...</p>
    </div>
    </div>
</body>

and in css like this:

.jumbotron {
    position: relative;
    background: #fff url("slide.jpg") center center;/*slide.jpg =>you image*/    
    width: 100%;
    height: 100%;
    background-size: cover;
    overflow: hidden;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM