Reputation: 19
If you see the image of mine where i gave the same style as told in youtube video and in that video the image is covered the div width and height
But when i tried the same my image is overflown instead of cover exactly to the div dimensions
why it has happened to my code but not for him in the video?`
#service-image {
height: 400px;
width: 70%;
background: url("../images/lesson\ img-2.jpg");
/* background-repeat: no-repeat; */
/* background-size: 50px 100px; */
/* background-size: contain; */
background-size: cover;
}
<div id="service-image"></div>
<h2 class="subtitle">Contact Us</h2>
<form>
<input type="text" placeholder="Full Name" class="input-form">
<input type="email" placeholder="Email" class="input-form">
<textarea></textarea>
<button>Submit</button>
</form>
`
Upvotes: 0
Views: 49
Reputation: 114
i think you have to use background-image:url(sth);width:100%
and then give this style to not to overflow overflow:hidden;
or if you want to show overflow with scroll overflow:scroll;
Upvotes: 1