重写元素的CSS'position:relative;'的正确方法是什么?使用Bootstrap 2.2.1? [英] What is the proper way to override an element's CSS 'position: relative;' using Bootstrap 2.2.1?

查看:159
本文介绍了重写元素的CSS'position:relative;'的正确方法是什么?使用Bootstrap 2.2.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Twitter Bootstrap 2.2.1 Initializr样板开发项目.为了正确覆盖Bootstrap的默认CSS属性,您需要在"main.css"中为受影响的类创建一个条目,然后添加所需的属性.

I am working on a project using the Twitter Bootstrap 2.2.1 Initializr boilerplate. In order to properly override Bootstrap's default CSS attributes you need to create an entry for the affected class in 'main.css' and add the desired attributes.

在这种特殊情况下,Bootstrap具有一个名为".collapse"的类,该类适用于默认导航栏.

In this particular case Bootstrap has a class called '.collapse' that is applied to the default navbar.

.collapse{
    position:relative;
    height:0;
    overflow:hidden;
    -webkit-transition:height .35s ease;
    -moz-transition:height .35s ease;
    -o-transition:height .35s ease;
    transition:height .35s ease
}

对我造成问题的部分是位置:相对;". 我需要没有立场声明.现在我知道我可以打开Bootstrap CSS文件并对其进行编辑,但是如果文件被更新,则更改将丢失.

The portion that is causing problems for me is the 'position: relative;'. I need there to be no position statement. Now I know that I can just open the Bootstrap CSS file and edit it but if the file gets updated that change will be lost.

覆盖此CSS条目的正确方法是什么?

What is the proper way of overriding this CSS entry?

推荐答案

在bootstrap.css之后包含您自己的CSS文件,并使用相同的选择器编写规则.至于position属性,您可以使用position: static;或任何您需要的东西.

Include your own CSS file after bootstrap.css and write a rule with the same selector. As for the position property, you could use position: static; or whatever you'll need.

这篇关于重写元素的CSS'position:relative;'的正确方法是什么?使用Bootstrap 2.2.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆