0
I have 2 Divs in my code, the first div is an image, the second div is a form, I want to put side by side the two, and when seen in the mobile it breaks, stay one div on top and the other on bottom, as I do?
form {
width: 400px;
padding: 1em;
border: 1px solid #CCC;
border-radius: 1em;
background-color: #f2f2f2;
overflow: hidden;
display: block;
}
div + div {
margin-top: 1em;
}
label {
display: inline-block;
width: 90px;
text-align: right;
}
input, textarea {
font: 1em sans-serif;
width: 300px;
-moz-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid #999;
}
input:focus, textarea:focus {
border-color: #000;
}
textarea {
vertical-align: top;
height: 5em;
resize: vertical;
}
.button {
padding-left: 90px;
}
button {
margin-left: .5em;
}
#main img{
margin-left: 25%;
}
<div id="main">
<img width="240px" src="https://www.sketchappsources.com/resources/source-image/google-chrome.png"/>
<div class="center" id="form">
<form action="/my-handling-form-page" method="post">
<div>
<label for="name"></label>
<input placeholder=" Nome Completo" type="text" id="name" name="user_name">
</div>
<div>
<label for="mail"></label>
<input placeholder=" E-mail" type="email" id="mail" name="user_email">
</div>
<div>
<label for="fone"></label>
<input placeholder=" Telefone" type="fone" id="fone" name="user_fone">
</div>
</form>
</div>
</div>
Put the code so we can help
– Anderson Henrique
One suggestion that works well, is to put the two Divs inside a <p> </p>, so they can adjust the page. But the fastest way you’ll ever run is with bootstrap.
– Renato Junior
Try, instead of using the tag
<img />
, use a<div />
with abackground-image
– yoyo