Overwriting media queries - min and max width

南笙酒味 提交于 2019-12-25 09:00:02

问题


I have this code in my first CSS file:

/* min-width */
@media (min-width: 768px) {
  .navbar-static-top {
    border-radius: 0;
  }
}

/* max-width */
@media (max-width: 767px) {
  .navbar-form .form-group {
    margin-bottom: 5px;
  }
  .navbar-form .form-group:last-child {
    margin-bottom: 0;
  }
}

I have this code in a CSS file linked after the first file:

/* min-width */ 
@media (min-width: 992px) {
  .navbar-static-top {
    border-radius: 0;
  }
}

/* max-width */
@media (max-width: 991px) {
  .navbar-form .form-group {
    margin-bottom: 5px;
  }
  .navbar-form .form-group:last-child {
    margin-bottom: 0;
  }
}

As you can see, the only difference between the two files is the min-width and max-width values.

I need the code in the second file to overwrite the first file. It needs to be as if the code in the first file doesn't exist. I do not have access to the first file, it's being pulled from a CDN. See this question: Modifying Bootstrap breakpoints after loading from a CDN. I customised bootstrap by changing the LESS variable @grid-float-breakpoint from @screen-sm-min to @screen-md-min to prevent the navbar from spilling over onto two lines. I diffed the customised and original compiled versions and the only difference was the values of the min-width and max-width of the media queries. The actual content of the media queries stays the same in both versions.

来源:https://stackoverflow.com/questions/42755990/overwriting-media-queries-min-and-max-width

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!