如何链接外部css以覆盖bootstrap css以获取居中元素?

时间:2015-08-30 20:58:56

标签: html css

我很难让网站响应,所以我从bootstrap下载了基本模板和导航示例,现在我想知道如何编辑导航栏?因为他们已经有多个css文件夹了。我尝试创建一个新的css文件并在那里进行编辑,但我似乎无法使其正常工作。我特别想做的是在容器/包装器中创建文本中心(我不确定它究竟是什么,但每个单词都在一个盒子里,我想把这个单词放在一个中心那个盒子

HTML:

db.once('open', function(callback)
{  
   app.get('/', function (req, res)
   {
      var name = getNameFrom(req);

      if (existsInDB(name) && tokenExistsInDBfor(name))
      {
         res.redirect('/render');

         /*
            Is checking that the shop (along with a permanent token)
            exists in my DB enough ?
            Shouldn't I check whether the current request comes with 
            a token that is equal to the one in my DB ?
            What if the token received with this request is different       
            from the one stored in my DB ?
         */

      }
      else res.redirect('/auth');
   });

   app.get('/auth', function (req, res)
   {    
      if (authenticated(req))
      {
          var token = getPermanentToken(); 
          storeItInDB(nameFrom(req), token);
          res.redirect('/render');

          /*
            aren't I supposed to do anything more 
            with the token I've received ? send it
            back/store it in the browser session as well maybe?
            is storing it in the db necessary ?
          */
      }
   }); 

   app.get('/render', function (req, res)
   {   
      /*
      How do I check that this request is coming 
      from an authorised shop that has the necessary token ?
      Simply checking my DB will not do 
      because there might be some inconsistency correct ?
      */

      res.sendFile(*file that will build app on the client*);
   });
});

感谢您花时间提供帮助,祝您有个美好的一天!

2 个答案:

答案 0 :(得分:2)

首先,确保您的自定义CSS文件在 Bootstrap CSS之后被称为

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="navbar.css" rel="stylesheet">
<link rel="stylesheet " href="yourCustom.css" />

其次,将其添加到您的自定义CSS:

.col-md-4 {
    text-align:center;
}

答案 1 :(得分:2)

为什么不使用Bootstrap自己的结构?

jsFiddle Demo

<div class="container">
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container-fluid">
            <div class="navbar-header">
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">Work</a></li>
                        <li><a href="#">About</a></li>
                        <li><a href="#">Contact</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
</div>