javascript - Angular 6 媒体查询问题

标签 javascript css angular sass

我在 Angular 6 网站上工作。我有一个名为 our-work.ts 的组件, 我在文件 global.scss 中全局定义它的媒体查询,就像这样,

@media only screen and (max-width: 767px){
  .pull-custom-left {
    float: none;
  }
  .popular-work .img-section .hovereffect a, .popular-work .img-section .hovereffect p {
    margin-top: 10px;
    font-size: 14px;
  }

除媒体查询之外的其他样式在组件中工作正常,但媒体查询不起作用。 这是我的工作组件.ts

@Component({
  selector: 'app-our-works',
  templateUrl: './our-works-talk.component.html',
  styleUrls: ['./our-works-talk.component.scss'],

})

最佳答案

您必须将文件 global.scss 添加到您的 angular.json 文件中。

"styles": [
  "src/styles.css",
  "src/global.scss"
],

关于javascript - Angular 6 媒体查询问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52699909/

相关文章:

html - 内容超出盒子区域

jquery - 从动态添加的选项卡中删除淡入淡出效果

javascript - 检查数组是否有重复项,如果有,我需要改变原始项并删除最后一个重复项

javascript - 表单提交 javascript 不工作

html - 自定义在 css 标签下划线

javascript - Ionic 2 可重用页面组件

angular - 几次测试后出现脚本错误

Angular 2 : @ContentChild - only immediate children

javascript - 该视频如何如此迅速地加载?

用于更改对象变量的 javascript 事件监听器