Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

css - How do i make home page responsive? Wordpress

Wordpress updated this site and the home page is now not responsive. Hero image is not filling up the entire screen. Another odd thing is if you increase and decrease (stretch) the browser window then the home page automatically continually increases to infinity. Any ideas on what is going on and how to fix this? Appreciate any input. I am just a newbie coder,

.banner .item {  
    background-size: cover;  
    background-position: 50%;  
    position: relative;  
    overflow: hidden;  
}

I tried

.banner .item {
   width: 100%;
   height: auto;
}

with no success.

Hard setting to specific pixel velues works fine, but its not what I am after. I need it to be responding to the browser size. What am I missing?

.banner .item {
   height: 700px;
}

URL: https://michaelhewat.com/

Incorrect:

Incorrect

Correct: Correct


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Instead of

.banner .item {
  height: 700px;
}

You can use full viewport(vh) - the header(px)

.banner .item {
  height: calc(100vh - 126px);
}

It will do what you are looking for ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...