0

我想使用@fontface 将Jquery UI 使用的字体系列更改为网络字体。我创建了自己的 css 文件,命名为my.css,并为它提供了以下 CSS:

@font-face {
    font-family: "Conv_mry_KacstQurn";
    src: url('fonts/mry_KacstQurn.eot#iefix') format('embedded-opentype'),
    url('fonts/mry_KacstQurn.woff') format('woff'), url('fonts/mry_KacstQurn.ttf') format('truetype'), url('fonts/mry_KacstQurn.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

body *{
font-family: "Conv_mry_KacstQurn";
}

我的页眉部分的代码如下:

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery UI Example Page</title>
<link type="text/css" href="css/my.css" rel="stylesheet" />
        <link type="text/css" href="css/custom-theme/jquery-ui-1.8.22.custom.css" rel="stylesheet" />

        <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>

        <script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>


        <script type="text/javascript">
/* initiation of UI code */
</script>
<style type="text/css">
            /*demo page css*/
            body{ font: 62.5% "Conv_mry_KacstQurn", sans-serif; margin: 50px;}
            .demoHeaders { margin-top: 2em; }
            #dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
            #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
            ul#icons {margin: 0; padding: 0;}
            ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left;  list-style: none;}
            ul#icons span.ui-icon {float: left; margin: 0 4px;}
        </style>
    </head>

在 my.css 中使用 body * 可以使一切顺利,并且 Web 字体也在 Jquery UI 元素中呈现。问题是当我想在页面中使用多个字体系列时。所以我想知道如何在不使用 body * 选择器的情况下设置要与 Jquery UI 元素一起使用的 Web 字体?

4

1 回答 1

0

感谢所有观众,我找到了答案。简单地说,它包括将两个链接的 css 文件的顺序替换为:

     <link type="text/css" href="css/custom-theme/jquery-ui-1.8.22.custom.css" rel="stylesheet" />

<link type="text/css" href="css/my.css" rel="stylesheet" />

然后从 css/custom-theme/jquery-ui-1.8.22.custom.css 复制以下 CSS 规则,然后将它们粘贴到 my.css 中,并将我想要的字体系列添加到那里找到的字体系列属性中:

 * Component containers
    ----------------------------------*/
    .ui-widget { font-family: "Conv_mry_KacstQurn",Verdana,Arial,sans-serif; font-size: 1.1em; }
    .ui-widget .ui-widget { font-size: 1em; }
    .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: "Conv_mry_KacstQurn",Verdana,Arial,sans-serif; font-size: 1em; }
    .ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
    .ui-widget-content a { color: #222222; }
    .ui-widget-header { border: 1px solid #4297d7; background: #2191c0 url(images/ui-bg_highlight-hard_75_2191c0_1x100.png) 50% 50% repeat-x; color: #eaf5f7; font-weight: bold; }
    .ui-widget-header a { color: #eaf5f7; }

就是这样,现在所有的 Jquery 元素都有我想要的字体系列。

于 2012-08-06T23:01:03.097 回答