Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.something, #something, & @something 2

Status
Not open for further replies.

KevinFSI

Programmer
Nov 17, 2000
582
US
I've used CSS extensively enough to know how to use classes and id's (. & #) but I was wondering if someone out there could give me an oh-so-brief synopsis of the ones that start with the @. What is the purpose? How are they called within the HTML? Is there an advantage they have over the others.

Thanks, Kevin
slanek@ssd.fsi.com
 
There called at-rules. They are used as commands almost (it's hard to describe). The one's I know about are:

@font-face
(used for more accurate font rendering you can download fonts with this i.e.
Code:
<STYLE TYPE=&quot;text/css&quot;>
@font-face {font-family: fontname; url(fonts/fontname.eot)
</STYLE>

@import
(used to import a stylesheet instead of using the LINK tag) i.e.
Code:
<STYLE TYPE=&quot;text/css&quot;>
@import url(styles/stylesheet.css)
</STYLE>

@media
(used to make your web page look different depending on what's rendering it (printer or screen)) i.e.
Code:
<STYLE TYPE=&quot;text/css&quot;>
@media print {font-family: Times New Roman;}
@media screen {font-family: Verdana;}
</STYLE>
This will print Times New Roman but show Verdana on the screen. As you can see they are rules to your Style sheets and you don't reference HTML tags to them they are rules or commands to help with the display.

@page
I've never used this one but I think you use it to control the page-attributes like margins and stuff on the print out.
 
Very cool. Thaks a million! Kevin
slanek@ssd.fsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top