简体   繁体   English

网站从浏览器到平板电脑都响应,但是在移动设备上没有响应。 我该如何纠正?

[英]Website is responsive from browser to tablet, however not responsive on mobile. How do I correct this?

I made a portfolio website using HTML, CSS, Bootstrap 4, and jQuery. 我使用HTML,CSS,Bootstrap 4和jQuery创建了一个投资组合网站。 The site seems to be acting just fine on the browser and up to tablet mode. 该网站在浏览器上和平板电脑模式下似乎运行良好。 However when I look at the site on my phone, I seem to be able to scroll into a blank area, the text within my banner image seems to get cut off and the my image in the "about me" portion shrinks to nothing. 但是,当我在手机上查看站点时,似乎可以滚动到空白区域,横幅图像中的文本似乎被剪切掉了,“关于我”部分中的图像也缩小了。 The website is www.reallybilly.com if I am not explaining it very well. 如果我不能很好地解释该网站,则为www.reallybilly.com。

I have played around with different viewpoints, and have tried different width's with @media nothing seems to be working. 我玩过不同的观点,并尝试了@media的不同宽度,但似乎没有任何效果。

body,
html {
height: 100%;
max-width: 100%;
}

.banner {
 background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 
 0.5)),
 url("../imgs/city/IMG-5676.JPG");
 height: 100vh;
 width: 100%;
 background-position: center;
 background-repeat: no-repeat;
 background-position: center;
 background-size: cover;
 position: relative;
 }

 .text-box {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
 }

I am hoping to make it completely responsive without having to redo the whole project. 我希望能够完全响应,而不必重做整个项目。

From inspecting your site, remove the 'padding:100px;' 在检查您的网站时,删除“ padding:100px;” from your #about CSS assignment. 从您的#about CSS分配中。 That padding is what's causing it on a mobile device. 这种填充是导致它在移动设备上的原因。

Better yet, use an @media to set that padding only when on a tablet or larger viewport. 更好的是,仅在平板电脑或更大的视口上使用@media设置填充。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM