473,698 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Confused on how to use @media.

Hello all,

I'm a little confused on how to implement @media to make some web pages
print better. From what I've been able to read so far, I need to set
the @media rules as the top items in my CSS. So I would write something
like (not sure of the formatting here):

@media print {

body { blah blah blah }; (does a semi-colon go here?)

div.whatever { visibility: hidden }

}

OK, so once I have set different parameters for print in my CSS, how do
I implement that in the HTML document? I've read a lot about how to use
@import in the <head> but I can't find anything (that I can understand)
on how to implement @media in the html document.

Thanks in advance for any help.

Viken K.

Dec 8 '05 #1
2 1496
Viken Karaguesian wrote:
Hello all,

I'm a little confused on how to implement @media to make some web pages
print better.


If you wish, you can avoid @media by creating separate stylesheets for
each medium:

<head>
<link rel="stylesheet " href="screen.cs s" type="text/css"
media="screen"> </link>
<link rel="stylesheet " href="print.css " type="text/css"
media="print"></link>
</head>

In this case, screen.css and print.css contain your styles for screen
and print, respectively.

Since you'll probably have many rules in common for screen and print, a
better solution is to create one single stylesheet:

<head>
<link rel="stylesheet " href="style.css " type="text/css"
media="screen,p rint"></link>
</head>

and style.css could look like this:

---
/* Common rules */
body { font-family: fantasy; }
h1 { border: 1px solid lime; }

@media screen {
/* Rules specifically for screen */
body { color: #faa; background-color: #002; }
a:hover { font-weight: bold; }
}

@media print {
/* Rules specifically for print */
body { color: #000; background-color: #fff; }
div#navigation { display: none; }
}
---

Note the positions of { } and ;

--
Garmt de Vries.

Dec 8 '05 #2
I see...so if I was to add "media=screen,p rint" in the <head> link, the
browser will automatically know which rules apply to which medium
because of the @media statement in the CSS, right?

Thanks.

Viken K.

Dec 8 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
2386
by: Geoff Cox | last post by:
Hello, I am trying to have 1. web pages in large font 2. web pages with smaller font for printing I am using <link rel="stylesheet" media="print" type="text/css"
56
6946
by: alan b | last post by:
I copied it and tried to edit the movie.htm below in the <PARAM NAME=*** location of the file where the videoclip is on my hard drive. It is already recorded by Windows Media Player. My version is 9.0 although it is coded 5.0 in this htm file. Let me know if it is able to be fixed. *** denotes where it is edited to locate the path where the videoclip is.
1
10333
by: Lonewolf | last post by:
Hi everyone, pls forgive me for my lack of knowledge and skills if my question sounds very stupid. I am trying to implement a video conferencing software and I am currently looking at a few set of technologies, among them WMP, RealMedia, H.323 and XviD (not sure if it is suitable for streaming even) . I would like to seek the advice of those experts on the following questions, 1) What is the best technologies to be used, in terms of...
0
1000
by: AshuPd | last post by:
Hi there!! I am really pleased to get such a plateform. Ok my problem is how could I make a dynamic media file play on the click event of an Image Button. There is class called System.Media.Soundplayer in .NET, But I am really confused how to do with it. Please someone help.... Thanks
2
1445
by: wavedancer | last post by:
I am confused about the syntax used in the style sheet that accompanies the website I've inherited and have been asked to tidy up. XHTML is new to me, and I've only used CSS for font and link styles in the past. The style sheet includes such things as div#header. Is this correct? I thought it should be either div header or #header. I can't find any reference to this online. Also, the html references two style sheets in addition to the...
3
1588
by: boris | last post by:
i want to learn a language and hav options between JAVA and DotNet languages.but i am totally confused abt what to do.as this forum is for DotNet only thats y i m askin y shud i preffer DotNet language like C#.net over JAVA.I am intrested in software and somewhat in game development.plz help.
1
1527
by: =?Utf-8?B?c2xvd3NwZWVk?= | last post by:
My WMP 11 was working just fine, then the automatic security updates installed KB835935. Media Player now stops playing audio and closes down after a few seconds. I did a sys restore, didn't help. I uninstalled KB835935, that didn't work either. I uninstalled a few programs that KB info said could interfere with WMP 11 even though it was working just fine prior to KB835935. That was a waste of time. I tried removing WMP through add...
0
2035
by: Konrad | last post by:
Hi everyone. I've got problem with converting xml file to xsd schema. The Xml file looks like: <?xml version="1.0" encoding="iso-8859-2"?> <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <title>Song Site</title> <media:title type="plain">TitleOfMedia</media:title> <link>http://www.foo.com</link> <description>Songs galore at different bitrates</description>
2
3437
by: Tyler Fleckenst | last post by:
I have the code to make windows media player start, I just need to make it start in fullscreen when it starts playing. Is this even possible? I'm so confused, ha. This is what I have so far: <!-- START OF MOVIE OBJECT --> <OBJECT ID="MediaPlayer" WIDTH="1100" HEIGHT="560" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"> <PARAM NAME="Avatar"...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.