Hey there, I'm facing an issue that needs fixing. I have a form that I need to place inside a box. So, I nested the form inside a div and added a background color to the div. The only problem is that the div is expanding to the entire width of the browser when I want it to stretch only as far as the content.
Check out this screenshot:
Screenshot
CSS CODE:
.content-wrapper {
background-color: #FFFFFF;
width: auto;
height: auto;
}
.input-text {
background-image: url("images/input-text.png");
background-repeat: no-repeat;
width: 214px;
height: 39px;
font-size: 14px;
font-family: "custom font", Tahoma, sans-serif;
color: #9aa1aa;
border: none;
padding-left: 11px;
padding-right: 11px;
}
.input-text:focus {
background-image: url("images/input-textf.png");
color: #34495e;
outline: none;
}
HTML CODE:
<div class="content-wrapper">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<?php
echo $dbnameErr;
echo $dbuserErr;
echo $dbpassErr;
echo $dbhostErr;
?>
Database Name<input class="input-text" type="text" name="db-name" value="<?php echo $dbname;?>" ><br />
Username<input class="input-text" type="text" name="db-username" value="<?php echo $dbuser;?>" ><br />
Password<input class="input-text" type="text" name="db-password" value="<?php echo $dbpass;?>" ><br />
Database Host<input class="input-text" type="text" name="db-host" value="localhost" ><br />
<input type="submit">
</form>
</div>