字体(来自Google字体)未显示在网站

时间:2016-07-04 18:56:35

标签: html css fonts

@import url(https://fonts.googleapis.com/css?family=Raleway);

/* CSS RESET */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    vertical-align: baseline;
}

/* END CSS RESET */

body {
    background-color: #F5F5F5;
    font-family: 'Raleway', sans-serif;
}

.header {
    padding: 0% 1% 0% 1%;
    width: 98%;
    height: 60px;
    border-bottom: 1px solid #dbdbdb;
    display:flex;
    align-items:center;
}

.header .logo {
    padding-top:15px;
    height:45px;
    width:24%;
    float: left;
}

.header .logo img {
    max-width: 100%;
    height:30px;
}

.search {
    text-align: center;
    width: 50%;
    float: left;
    vertical-align: middle;
}

.mb {
    display: none;
}

.search input[type="text"] {
    border: 0;
    background-color: transparent;
    color: #dbdbdb;
    border: 1px solid #111111;
    border-radius: 9px;
    text-align: center;
}

.search input[type="text"]:focus {
    border: 2px solid #007AFF;
    outline: none;
    color: black;
}

.reglog {
    width: 24%;
    float: right;
    text-align: right;
}

.reglog button {
    background-color: transparent;
    border: 2px solid #009CFF;
    border-radius: 15px;
    padding: 1.5%;
    margin: 1%;
}

@media only screen and (min-width: 0px) and (max-width: 599px) {
    .search input[type="text"] {
        display: none
    }
    .mb {
        display: block;
    }
    body {
        font-family: 'Raleway'
    }
}

那是我的CSS。我试过通过文件链接它,通过HTML,没有任何作用。这是唯一的CSS文件。我真的在这里没有想法,一切都运转良好。这可能是什么问题?

3 个答案:

答案 0 :(得分:1)

作为谷歌字体同时包含在像这样的css文件中

@import url(https://fonts.googleapis.com/css?family=Raleway:400,500,400italic);

而不是

@import url(https://fonts.googleapis.com/css?family=Raleway);

答案 1 :(得分:0)

你必须把链接放在html的head部分,而不是css中。像这样:

<head>
<link rel="https://fonts.googleapis.com/css?family=Raleway">
</head>

然后,您可以在样式表中调用font-family。

答案 2 :(得分:0)

显然,当我在Apache上制作VirtualHosts时出现了一些问题,我不知道如何禁用VHost并返回我的标准URL方案解决了这个问题。奇怪..

无论如何,谢谢所有想要帮助的人,我很感激 告别!