Search code examples
htmlformstextboxborder

html form inside a box?


I would like to put a form inside a box, or have a border around a form but I got stuck. The background has to be white and I was thinking that perhaps a transparent option was ok. Any expert out there that has some simple idea how to solve it? Enclosing some code. Jsfiddle

What I want to accomplish

<body>
<div id="border"></div>
<div id="text">Auf dem tisch</div>
</body>

body {background: white;}

#border {
        border: 2px solid black;
        position: absolute;
        z-index: 1;
        width: 100px;
        height: 80px;
        margin-center: 0;
        padding: 15px;
        border-radius: 1px;
        background: navy;
        opacity: 0.2;
    }

#text   {
        margin-center: 0;
        z-index: 2;
        color: black;
        font-weight: bold;
    }

Solution

  •     <div class="box">
    <form>
    ..
    ..
    </form>
    </div>
    
    // css style to make border in center of the form
    
    .box{
    margin:0 auto; 
    width:600px //you can set it in %.
    padding:20px;
    background:#f9f9f9;
    border:2px solid #333;
    }