18910140161

html-@媒体查询没有响应tablet和desktop视图-堆栈溢出

顺晟科技

2022-10-19 13:14:46

31

CSS代码。

               /* media query for tablet */
               @media only screen and (max-width: 768px) {
               .cta {
               font-size: 2.5rem;
               padding: 20px 60px;
               }
               h1 .section-title {
               font-size: 6rem;
               }

               /* hero section */
               #hero h1 {
               font-size: 7rem;
               }
               /* end of hero section */

               /* service section */
               #services .service-bottom .services-item {
               flex-basis: 45%;
               margin: 2.5%;
               }
               /* end of service section */
               }
               /* end of media query for tablet */

               /* media query for desktop */
               @media only screen and (min-width: 1500px) {
               /* header */
               #header .hamburger {
                  display: none;
               }
               /* end of header */
               }
               /* end of media query for desktop */

HTML代码

               /* media query for tablet */
               @media only screen and (max-width: 768px) {
               .cta {
               font-size: 2.5rem;
               padding: 20px 60px;
               }
               h1 .section-title {
               font-size: 6rem;
               }

               /* hero section */
               #hero h1 {
               font-size: 7rem;
               }
               /* end of hero section */

               /* service section */
               #services .service-bottom .services-item {
               flex-basis: 45%;
               margin: 2.5%;
               }
               /* end of service section */
               }
               /* end of media query for tablet */

               /* media query for desktop */
               @media only screen and (min-width: 1500px) {
               /* header */
               #header .hamburger {
                  display: none;
               }
               /* end of header */
               }
               /* end of media query for desktop */

我对tablet和desktop的媒体查询没有响应,尽管VSCODE中没有代码错误。我首先设计了手机版,然后是平板媒体查询,最后是桌面媒体查询,都没有响应。我的媒体查询位于关键帧下面。


顺晟科技:

请看一下这些尺寸

https://getbootstrap.com/docs/4.1/layout/overview/

尝试以下操作: @媒体屏幕和(最大宽度:768px){

}

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航