So i have this login bar(i DO NOT copy this from w3schools.com, i just borrow the avatar :p ):
<!DOCTYPE html>
<html>
<head>
<style> {
button.cancle:hover
background-color:red;
cursor: pointer;
}
button.cancle {
border: none;
padding: 10px 18px;
background-color:#f44336;
color: white;
margin: 8px;
}
input[type=submit] {
color: white;
background-color: #2D9409;
cursor: pointer;
}
input {
padding: 8px;
margin: 8px;
box-sizing: border-box;
width: 100%;
border: 1px solid #ccc;
}
div {
padding: 40px;
background-color: LightGrey;
display: block;
}
div.img {
text-align:center;
}
</style>
</head>
<body style="font-family:sans-serif">
<div class="login">
<form>
<div class="img">
<img src=http://www.w3schools.com/howto/img_avatar2.png height=300px width=300px style="border-radius:50%">
</div>
<label>Username:</label><br>
<input type=text placeholder="Username..." required><br>
<label>Password:</label><br>
<input type=password placeholder="Password..." required>
<br>
<input type=submit value=Login>
<button class="cancle">Cancle</button>
<span style="float:right; margin: 16px;">Forgot <a href="#">password?</a></span>
</form>
</div>
</body>
</html>
The proplem is if i resize my window big enough the image will start popping out of the <div>
. Can someone help me with this?
And answer using css only please, thanks !(i don't know how to use viewport, sorry)