如何在HTML文件中覆盖外部CSS? [英] How can I over-ride external CSS inside HTML file?

查看:81
本文介绍了如何在HTML文件中覆盖外部CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



伙计们,


我是CSS的新手并且意识到通过在html新闻组中发帖,我

可能会通过在html

新闻组中提出CSS问题来打扰一两个读者,但我的ISP只有一个小的CSS新闻组可用 -

我希望有人在这里或许可以提供帮助。


我有一个外部样式表,我从头脑中调用/安装

标签如下:


< link href =" css / module.css"的rel ="样式表" type =" text / css">

< link href =" css / vst.css"的rel ="样式表" type =" text / css">


我想覆盖样式表中定义的字体

但剩下的就剩下了设置相同 - 我肯定必须有一个

方法,这将允许我通过html(或样式标签)过度使用

出现在上述之后的某个地方 - 但我不知道哪个(或如何)。


有人可以帮忙吗?所有回复请通过新闻组,以便其他人

也可以学习...


提前致谢,

randelld

解决方案

通过新闻组回复请写道:

人们,
新闻组中发帖,我可能会通过在html新闻组中提出一个CSS问题来打扰一两个读者,但是我的ISP只有
一个小的CSS新闻组可用 - 我希望有人在这里
也许可以提供帮助。

我有一个外部样式表我打电话/安装从
里面我的头像是这样的:

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

我想覆盖
样式表中定义的字体但是离开设置的其余部分相同 - 我确定必须有一种方法可以让我通过某个地方出现的html(或样式标签)过度骑行
以上 - 但我不知道哪个(或如何)。




< link>之后元素但仍在< head>内:

< style type =" text / css">

body {

字体-family:Arial,sans-serif;

font-weight:bold;

}

< / style>


确保你在这个样式块中写的样式不比样式表中写的样式更具特色。


-

Els
http://locusmeus.com/

Sonhos vem。 Sonhos v?o。 Orestoébritfeito。

- Renato Russo -


Els写道:

通过新闻回复Group Please写道:

人们,

我是CSS的新手,并通过在html
新闻组中发帖来实现我可能会通过在html新闻组中提出一个CSS问题来打扰一两个读者,但我的ISP只有一个小的CSS新闻组可用 - 我希望有人在这里
也许能够帮助。

我有一个外部样式表,我可以在我的头部标签中调用/安装,如下所示:

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

我想覆盖
样式表中定义的字体但是离开设置的其余部分相同 - 我确定必须有一种方法可以让我通过某个地方出现的html(或样式标签)过度骑行
以上 - 但我不知道哪个(或如何)。



< link>之后元素但仍然在< head>内:
< style type =" text / css">
body {
font-family:Arial,sans-serif;
font-weight:bold;
}
< / style>

确保您在此样式块中编写的样式不具有特定于样式表中写的样式。




感谢您的快速回复 - 我已经尝试了你的建议,我已经

看到一个小小的变化 - 为了确认发生了变化,我交换了你建议的字体系列的

顺序,并注意到表格外只有字体

更改 - 表格中的任何内容都是按照

样式表。


因为我的大多数表格单元格都有class = formLabel,而我的

样式表有一个为formLabel设置的样式,有没有一种方法我可以用
用来过这个类?我已经尝试过使用上面的语法了,但是

为''formLabel'改变了''body''这个词但是没有用。


非常感谢所有帮助 - 我实际上刚刚下载了CSS

文件用于CSS2而我正在查看字体部分 - 但是你有什么内容

可以帮助我一路走来,非常感谢,


提前感谢,

randelld


回复通过新闻组请写道:

Els写道:

回复通过新闻组请写道:

人们,

我是CSS的新手并且意识到通过在html
新闻组中发帖,我可能会感到不安或者两个读者通过在html新闻组中提出一个CSS问题但是我的ISP只有一个小的CSS新闻组可用 - 我希望有人在这里
可能能够提供帮助。
我有一个外部样式表,我可以在我的头部标签中调用/安装,如下所示:

< link href =" css / module.css" rel =" stylesheet"
type =" text / css"> < link href =" css / vst.css" rel =" stylesheet"
type =" text / css">
我想覆盖
样式表中定义的字体,但保留其余部分设置相同 - 我确定必须有一种方法可以让我通过上面的某个地方出现的html(或样式标签)来过度使用
- 但是我不知道哪个(或如何)。



< link>之后元素但仍然在< head>内:
< style type =" text / css">
body {
font-family:Arial,sans-serif;
font-weight:bold;
}
< / style>

确保您在此样式块中编写的样式不比特定于样式表中写的样式。



感谢您的快速回复 - 我已经尝试了您的建议并且我已经看到了一个小小的变化 - 为了确认发生了变化,我交换了你建议的字体系列的
顺序,并注意到只有表格之外的字体正在改变 - 表格中的任何内容都是按照
样式表。

由于我的大多数表格单元格都有class = formLabel,而且我的
样式表有一个为formLabel设置的样式,有没有一种方法我可以
用来骑这个班吗?我已经尝试过使用上面的语法了,但是为了formLabel改变了body这个词,但是没有用。

所有帮助都非常感谢 - 我实际上刚刚下载了CSS2的PDF
文件,而且我正在查看字体部分 - 但是你可以做的任何事情都可以帮助我一路走来,非常感谢, />
在此先感谢,
randelld




我得到了...在你的帮助下...谢谢...


为了覆盖班级''formLabel'的字体,我已经用


< style type =" ; text / css">

..formLabel {font-family:Baskerville," Heisi Mincho W3",Symbol,serif}

< / style>


我从CSS2上的PDF中获得了这些字体名称,并且我注意到我的风格

表格的前缀是句号/句号 - 我有< link>之后的

样式在我的html文件中的标签,它改变了字体

通过。


再次感谢您的提示帮助,

randelld



Folks,

I''m new to CSS and realise that by posting in the html newsgroup, I
might upset one or two readers by raising a CSS question in an html
newsgroup however my ISP only has one small CSS newsgroup available -
I''m hoping someone here might be able to help.

I have an external style sheet which I call/install from inside my head
tags like so:

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

I would like to over-ride the fonts that are defined in the style sheet
but leave the rest of the setup the same - I''m sure there must be a
method that will allow me to over ride this via an html (or style tag)
that appears somewhere after the above - but I don''t know which (or how).

Can someone help? All replies please via the newsgroup so that others
can learn too...

Thanks in advance,
randelld

解决方案

Reply Via News Group Please wrote:

Folks,

I''m new to CSS and realise that by posting in the html
newsgroup, I might upset one or two readers by raising a
CSS question in an html newsgroup however my ISP only has
one small CSS newsgroup available - I''m hoping someone here
might be able to help.

I have an external style sheet which I call/install from
inside my head tags like so:

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

I would like to over-ride the fonts that are defined in the
style sheet but leave the rest of the setup the same - I''m
sure there must be a method that will allow me to over ride
this via an html (or style tag) that appears somewhere
after the above - but I don''t know which (or how).



After the <link> elements but still inside the <head>:
<style type="text/css">
body{
font-family:Arial, sans-serif;
font-weight:bold;
}
</style>

Make sure that the styles you write in this styleblock aren''t
less specific than the styles written in the stylesheet.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos v?o. O resto é imperfeito.
- Renato Russo -


Els wrote:

Reply Via News Group Please wrote:

Folks,

I''m new to CSS and realise that by posting in the html
newsgroup, I might upset one or two readers by raising a
CSS question in an html newsgroup however my ISP only has
one small CSS newsgroup available - I''m hoping someone here
might be able to help.

I have an external style sheet which I call/install from
inside my head tags like so:

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

I would like to over-ride the fonts that are defined in the
style sheet but leave the rest of the setup the same - I''m
sure there must be a method that will allow me to over ride
this via an html (or style tag) that appears somewhere
after the above - but I don''t know which (or how).


After the <link> elements but still inside the <head>:
<style type="text/css">
body{
font-family:Arial, sans-serif;
font-weight:bold;
}
</style>

Make sure that the styles you write in this styleblock aren''t
less specific than the styles written in the stylesheet.



Thanks for the prompt reply - I''ve tried what you''ve suggested and I''ve
seen a small change - To confirm changes were happening, I swapped the
order of the font family you suggested and noted that only the fonts
outside of tables were changing - anything inside a table was as per the
style sheet.

Since the majority of my table cells have "class=formLabel", and my
style sheet has a style set for formLabel, is there a method that I can
use to over ride this class? I''ve tried using your syntax above, but
changing the word ''body'' for ''formLabel'' but that didn''t work.

All help is much appreciated - I''ve actually just downloaded the PDF
file for CSS2 and I''m looking at the fonts section - but anything you
can do to help me along my way would be greatly appreciated,

thanks in advance,
randelld


Reply Via News Group Please wrote:

Els wrote:

Reply Via News Group Please wrote:

Folks,

I''m new to CSS and realise that by posting in the html
newsgroup, I might upset one or two readers by raising a
CSS question in an html newsgroup however my ISP only has
one small CSS newsgroup available - I''m hoping someone here
might be able to help.
I have an external style sheet which I call/install from
inside my head tags like so:

<link href="css/module.css" rel="stylesheet"
type="text/css"> <link href="css/vst.css" rel="stylesheet"
type="text/css">
I would like to over-ride the fonts that are defined in the
style sheet but leave the rest of the setup the same - I''m
sure there must be a method that will allow me to over ride
this via an html (or style tag) that appears somewhere
after the above - but I don''t know which (or how).



After the <link> elements but still inside the <head>:
<style type="text/css">
body{
font-family:Arial, sans-serif;
font-weight:bold;
}
</style>

Make sure that the styles you write in this styleblock aren''t less
specific than the styles written in the stylesheet.


Thanks for the prompt reply - I''ve tried what you''ve suggested and I''ve
seen a small change - To confirm changes were happening, I swapped the
order of the font family you suggested and noted that only the fonts
outside of tables were changing - anything inside a table was as per the
style sheet.

Since the majority of my table cells have "class=formLabel", and my
style sheet has a style set for formLabel, is there a method that I can
use to over ride this class? I''ve tried using your syntax above, but
changing the word ''body'' for ''formLabel'' but that didn''t work.

All help is much appreciated - I''ve actually just downloaded the PDF
file for CSS2 and I''m looking at the fonts section - but anything you
can do to help me along my way would be greatly appreciated,

thanks in advance,
randelld



I got it... with your help... thanks...

In order to over-ride the font for the class ''formLabel'' I''ve tested it with

<style type="text/css">
..formLabel { font-family: Baskerville, "Heisi Mincho W3", Symbol, serif }
</style>

I got those font names from the PDF on CSS2 and I noted that my style
sheets had their classes prefixed with a period/full-stop - I have the
styles after the <link> tags in my html file and it changed the font
through-out.

Thanks again for the prompt help,
randelld


这篇关于如何在HTML文件中覆盖外部CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆