简体   繁体   English

重命名网格中的CSS代码

[英]Renaming css code in grid

I am having problems renaming some classes from a grid I'm working on. 我在从正在处理的网格中重命名某些类时遇到问题。

The current code is this: 当前代码是这样的:

.col,
   .cols {
    margin-left: 4%; 
  }

  .col:first-child,
  .cols:first-child {
    margin-left: 0; 
  }


  .one.col,
  .one.cols, { 
    width: 4.66666666667%; 
  }

And then the html code is: 然后html代码是:

<div class="one col">One</div>
  <div class="eleven cols">Eleven</div>

The above code works but I need to change the class names to work so the html code goes like this: 上面的代码可以工作,但是我需要更改类名才能工作,因此html代码如下所示:

 <div class="one-col">One</div>
  <div class="eleven-cols">Eleven</div>

My question is... How do I change the code below so that the above html works? 我的问题是...如何更改下面的代码,以便上面的html起作用?

.col,
   .cols {
    margin-left: 4%; 
  }

  .col:first-child,
  .cols:first-child {
    margin-left: 0; 
  }


  .one.col,
  .one.cols, { 
    width: 4.66666666667%; 
  }

Just tweak the CSS: 只需调整CSS:

.one-col,.eleven-cols{
    margin-left: 4%; 
}

.one-col:first-child,.eleven-cols:first-child {
    margin-left: 0; 
}


.one-col { 
    width: 4.66666666667%; 
}

.eleven-cols {
    width: 51.3333333334%;
}

I am not clear on why you need only one class because we can declare multiple classes in class attribute. 我不清楚您为什么只需要一个类,因为我们可以在class属性中声明多个类。

But anyways. 但是无论如何。 hope below code will help you, 希望下面的代码对您有帮助,

.one-col{
    margin-left: 4%; 
    width: 4.66666666667%; 
}
.eleven-cols{
    margin-left: 4%; 
    width: 51.3333333334%;
}
.one-col:first-child,.eleven-cols:first-child{
    margin-left: 0; 
}

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

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