怎么通过外部引用CSS,让一个页面里有多种字体效果?

发布网友

我来回答

5个回答

热心网友

如先建个css.css文件存根目录下,内容如下:
.css {
font-family: "宋体";
font-size: 9px;
color: #000;
}

.css01 {
color: #000;
font-size:12px;
font-weight:bold;
font-family: "华文楷体";
}
a.css01:link { color: #333;text-decoration: none;}
a.css01:visited {text-decoration: none; color: #666;}
a.css01:hover { text-decoration: underline;color: #000;}
a.css01:active {text-decoration: none;color: #00397f;}

.css02 {
color: #00397f; font-weight:bold
}
a.css02:link {color: #00397f;text-decoration: none;}
a.css02:visited {text-decoration: none;color: #00397f;}
a.css02:hover {text-decoration: underline;color: #00397f;}
a.css02:active {text-decoration: none;color: #00397f;}

再在引用页内编写如下:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>css外部引用</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>

<body class="css">
<p>默认字体</p>
<p class="css02">更改过的字体</p>
<p><a href="#" class="css01">连接1</a></p>
<p><a href="#" class="css02">连接2</a></p>
<p></p>
</body>
</html>

这只是个例子,你自己再以一推三哈~!~

热心网友

在实现效果上外链和内部其实是一样的 你可以尝试着去.css文件里去改动这些东西 至于你说 哪些行要什么样子的 很容易

直接去给这个行定义一个class或者id 然后再在CSS里写上 他要用的字体 font-family:"宋体" 就可以了

多种样式 你可以直接空格隔开 比如 class="abc bbb" 只要不重复 都可以显示的

还有一点你要注意就是 内部的会覆盖外部的 优先级会高一些 如果外部定义好了 你也可以内部来覆盖它们

热心网友

其实和你直接在网页里一样的原理,你把想改变的字体放在一个标签里并给这个标签命名(<span class="xx">样式文字</span>)。然后在样式文件里设置这个标签的属性。你直接在网页里操作是自动加了一个命名的标签。

热心网友

很简单哦,你知道在样式表里写,比如:

.aaa { font-family:Verdana, Geneva, sans-serif}
.bbb { font-family:"宋体"}

如果你超链接需要2种样式效果,可以这样写.
.ft01 { color: #00397f; font-size:14px; font-weight:bold}
a.ft01:link {color: #00397f;text-decoration: none;}
a.ft01:visited {text-decoration: none;color: #00397f;}
a.ft01:hover {text-decoration: underline;color: #00397f;}
a.ft01:active {text-decoration: none;color: #00397f;}

.ft02 { color: #00397f; font-weight:bold}
a.ft02:link {color: #00397f;text-decoration: none;}
a.ft02:visited {text-decoration: none;color: #00397f;}
a.ft02:hover {text-decoration: underline;color: #00397f;}
a.ft02:active {text-decoration: none;color: #00397f;}

然后用class调用样式就可以了.

热心网友

比如样式代码写在css.css文件里
外部调用:
<link href="css.css" rel="stylesheet" type="text/css">

哦,指一个链接里多种样式
那就在链接里再加其他标签如div或span 对标签加样式
如:<a href="#"><div class="样式1">文字</div><div class="样式2">连接</div></a>

或者简单变通下<a href="#" class="样式1">文字</a><a href="#" class="样式2">连接</a>

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com