使用@print避免多个样式表 [英] Using @print to avoid multiple style sheets
问题描述
我不想为屏幕和打印介质加载两个样式表。我很难理解@print语句或语法的使用。
有人请提供一个简单的解释。
>
例如...
如果我有一个样式表,指定media =" all,"以下是正确的
语法中心文本用于打印,但不是用于屏幕演示?
..divClass1 {
text -align:left;
}
@print .divClass1 {
text-align:center;
}
-
Ed Jay(删除''M''通过电子邮件回复)
赢了对抗乳腺癌的战争。
了解事实可以挽救你的生命。
http://www.breastthermography.info
I do not want to load two style sheets for screen and print media. I''m
having difficulty grasping the use of the @print statement, or its syntax.
Would someone please provide a simple explanation.
For example...
If I have a style sheet specifying media="all," is the following correct
syntax to center text for printing, but not for screen presentation?
..divClass1 {
text-align:left;
}
@print .divClass1 {
text-align:center;
}
--
Ed Jay (remove ''M'' to reply by email)
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
推荐答案
Ed Jay写道:
Ed Jay wrote:
我不想为屏幕和打印介质加载两个样式表。我很难理解@print语句或语法的使用。
有人请提供一个简单的解释。
>
例如...
如果我有一个样式表,指定media =" all,"是以下正确的
语法中心文本打印,但不是屏幕演示?
I do not want to load two style sheets for screen and print media. I''m
having difficulty grasping the use of the @print statement, or its syntax.
Would someone please provide a simple explanation.
For example...
If I have a style sheet specifying media="all," is the following correct
syntax to center text for printing, but not for screen presentation?
更正语法:
@media print {
.divClass1 {
text-align:center;
}
}
-
谨防错误以上代码;我只是证明它是正确的,而不是
尝试过它。 - Donald E. Knuth
Corrected syntax:
@media print {
.divClass1 {
text-align: center;
}
}
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Joshua Cranmer写道:
Joshua Cranmer wrote:
> Ed Jay写道:
>Ed Jay wrote:
>我不想为屏幕和打印介质加载两个样式表。我很难掌握@print语句或语法的使用。
有人请提供一个简单的解释。
例如...
如果我有一个样式表,指定media =" all,"是如何正确的语法中心文本打印,但不是屏幕演示?
>I do not want to load two style sheets for screen and print media. I''m
having difficulty grasping the use of the @print statement, or its syntax.
Would someone please provide a simple explanation.
For example...
If I have a style sheet specifying media="all," is the following correct
syntax to center text for printing, but not for screen presentation?
更正的语法:
@media print {
.divClass1 {
text-align:中心;
}
}
Corrected syntax:
@media print {
.divClass1 {
text-align: center;
}
}
谢谢。我认为这会在一个
media = all表格中取代之前的divClass1样式,就像我给出的例子一样?
我也认为我可以在
@print {..}中包含多个声明?
再次感谢。
-
Ed Jay(删除''M''通过电子邮件回复)
赢得抗击乳腺癌的战争。
了解事实可以挽救你的生命。
http://www.breastthermography.info
Ed Jay写道:
Ed Jay wrote:
我不想为屏幕和打印媒体加载两个样式表。我很难理解@print语句或语法的使用。
有人请提供一个简单的解释。
>
例如...
如果我有一个样式表,指定media =" all,"以下是正确的
语法中心文本用于打印,但不是用于屏幕显示?
.divClass1 {
text- align:left;
}
@print .divClass1 {
text-align:center;
}
I do not want to load two style sheets for screen and print media. I''m
having difficulty grasping the use of the @print statement, or its syntax.
Would someone please provide a simple explanation.
For example...
If I have a style sheet specifying media="all," is the following correct
syntax to center text for printing, but not for screen presentation?
.divClass1 {
text-align:left;
}
@print .divClass1 {
text-align:center;
}
在CSS中没有@print这样的东西。你想要做的事情的正确形式是
@media print {
.divClass1 {text-居中对齐; }
}
In CSS there is no such thing as @print. The correct form for what
you''re trying to do is
@media print {
.divClass1 { text-align: center; }
}
这篇关于使用@print避免多个样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!