Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

How Can I make a background Image responsive according to specifications

$
0
0

Having a requirement from Zeplin I need to have an image on the left of the screen and for it to be responsive, So far i have failed in making it responsive and I will need some help in the right direction I will put up an image of what I have succeeded in doing.

My screen work

Zeplin Requirements

I will paste the code of my css

.sign-in-image {
  width: 40%;
  height: 100vh;
  float: left;
  border: solid 1px #979797;
  background-repeat: no-repeat;
  background-size: contain;

my Sign up react code

const SignIn = () => (
<div className="sign-in">
    <div className="image-container">
        <div className="sign-in-image" style={{ backgroundImage: `url(${signin})` }} src = {signin} alt="logo" />
    </div>
    <div className="right">
        <input  className='textField' placeholder="Username" />
        <input  className='textField' placeholder="Password" />
        <button type="button" className='signIn'>sign in</button>
        <p className='forgot'>Forgot username or password</p>
        <p className='signUp'>Don’t have an account? Sign up</p>
    </div>  
</div>
)

export default SignIn;

css file

.sign-in-image {
  width: 40%;
  height: 100vh;
  float: left;
  border: solid 1px #979797;
  background-repeat: no-repeat;
  background-size: cover;
}

.right{
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;

}

.textField{
  height: 47px;
  width: 600px;
  outline: 0;
  border-width: 0 0 2px;
  border-color: #f1f1f1;
  margin-top: 44px;
  text-align: center;
  border-bottom:thin dashed grey;


}

.textField::placeholder{
  width: 600px;
  height: 47px;
}

.signIn{
  width: 100px;
  height: 48px;
  border-radius: 24px;
  background-color: #f1316b;
  color: #fff;
  margin-top: 45px;
  border: 0;
}

.forgot{
  font-size: 18px;
  font-weight: normal;
  font-stretch: normal;
  font-style: italic;
  line-height: normal;
  letter-spacing: normal;
  color: #2e1150;
  font-family: 'Nunito';
  margin-top: 60px;
  width: 241px;
  height: 24px;
}

.signUp{
  font-size: 20px;
  font-weight: normal;
  font-stretch: normal;
  font-style: normal;
  line-height: normal;
  letter-spacing: normal;
  color: #2e1150;
  margin-top: 187px;
}


@media only screen and (max-width: 768px){
  .sign-in-image {
    width: 60%;
    height: 100vh;
  }
}

@media only screen and (max-width: 640px){
  .sign-in-image {
    width: 60%;
    height: 100vh;
  }
}

I hope someone can lead me in the right direction to making it responsive without the picture being eaten Thank you


Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>