当前位置: 动力学知识库 > 问答 > 编程问答 >

html - Adding bootstrap & Font awesome ruins css-why?

问题描述:

Since I added bootstrap and font awesome to my html file, most of the css done before just disappeared (background-color, google fonts)

<head>

<meta charset="utf-8">

<title>Games</title>

<link rel="stylesheet" href="main.css">

<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

<link href='https://fonts.googleapis.com/css?family=Orbitron:400,500' rel='stylesheet' type='text/css'>

<link href='https://fonts.googleapis.com/css?family=Homemade+Apple' rel='stylesheet' type='text/css'>

</head>

Does someone know why? Thanks!!

网友答案:

Move your main.css file declaration to after your bootstrap and font-awesome declarations. Since CSS is cascading the later styles are overwriting your custom styles.

<head>
    <meta charset="utf-8">
    <title>Games</title>
    <link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

    <link href='https://fonts.googleapis.com/css?family=Orbitron:400,500' rel='stylesheet' type='text/css'>       
    <link href='https://fonts.googleapis.com/css?family=Homemade+Apple' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" href="main.css">  
</head>
分享给朋友:
您可能感兴趣的文章:
随机阅读: