473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How do I reference an Object ID in my CSS?

Hello,

This is my first post to this group. A little background first: I'm not
not new to web-design, but new to manual coding :>) I'm trying to move
from total dependence on FrontPage to more manual coding and
positioning. So far I think I've done OK for a newbie (you can go to
http://home.comcast.net/~vikenk to see my latest site, which is based
mostly on a CSS). But now I have a question:

I'm trying to position a Java Applet using CSS. I've given my applet an
ID, as follows:

<applet code="slideways.class" ID="slide">

Now, when I want to position this in my CSS sheet, how do I reference
the ID? Would I write something like:

id.slide {height;width;my positioning info}

I've gone to W3 Schools online and foud nothing specific about this.

I suppose the big-picture question here is: Would/Should I even do that
at all? Would it be more "proper" to just create a Style in my CSS then
apply that to the Applet? So then my CSS would include:

..slide {height;width;my positioning info}

and my HTML tags would look like:

<applet code="slideways.class" class="slide">

Any replies would be greatly appreciated. Again, I'm still a relative
newbie to CSS and coding, so some of the above may not even make total
sense :>)

Thanks in advance,

Viken K.

Jul 21 '05 #1
3 2646
vi****@aol.com wrote:
Hello,

This is my first post to this group. A little background first: I'm not
not new to web-design, but new to manual coding :>) I'm trying to move
from total dependence on FrontPage to more manual coding and
positioning. So far I think I've done OK for a newbie (you can go to
http://home.comcast.net/~vikenk to see my latest site, which is based
mostly on a CSS). But now I have a question:

I'm trying to position a Java Applet using CSS. I've given my applet an
ID, as follows:

<applet code="slideways.class" ID="slide">

Now, when I want to position this in my CSS sheet, how do I reference
the ID? Would I write something like:

id.slide {height;width;my positioning info}

I've gone to W3 Schools online and foud nothing specific about this. The way to reference elements by their id is:

#slide { ... }
I suppose the big-picture question here is: Would/Should I even do that
at all? Would it be more "proper" to just create a Style in my CSS then
apply that to the Applet? So then my CSS would include:

.slide {height;width;my positioning info}

and my HTML tags would look like:

<applet code="slideways.class" class="slide"> Use id, if your element is *unique*, e.g. if the CSS rules are only used for
this specific applet. An id identifies a specific element that only appears
once on a page.
Use class, if the CSS rules (may) apply to several elements that all belong
to this class.
For beginners, using only classes may be sufficient. Advantages of ids are,
that #foo rules have higher precedence than .foo rules and elements with an
id are easier to use when working with JavaScript.

Any replies would be greatly appreciated. Again, I'm still a relative
newbie to CSS and coding, so some of the above may not even make total
sense :>)


As a side note: the <applet> tag is deprecated, you should (or must,
depending of the doctype you use) use <object> instead.
Hope this helps,
Benjamin

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Jul 21 '05 #2
vi****@aol.com wrote:
Hello,

This is my first post to this group. A little background first: I'm not
not new to web-design, but new to manual coding :>) I'm trying to move
from total dependence on FrontPage to more manual coding and
positioning. So far I think I've done OK for a newbie (you can go to
http://home.comcast.net/~vikenk to see my latest site, which is based
mostly on a CSS). But now I have a question:

I'm trying to position a Java Applet using CSS. I've given my applet an
ID, as follows:

<applet code="slideways.class" ID="slide">

Now, when I want to position this in my CSS sheet, how do I reference
the ID? Would I write something like:

id.slide {height;width;my positioning info}
Do applet#slide {height;width;my positioning info;}
I suppose the big-picture question here is: Would/Should I even do that
at all? Would it be more "proper" to just create a Style in my CSS then
apply that to the Applet? So then my CSS would include:

.slide {height;width;my positioning info}

and my HTML tags would look like:

<applet code="slideways.class" class="slide">

Any replies would be greatly appreciated. Again, I'm still a relative
newbie to CSS and coding, so some of the above may not even make total
sense :>)


The key difference between using id and class is that you can have only
one instance of a given id on a page, whereas with class you can have
many. E.g. you can have id="a" and id="b" on a page, but you can't have
id="a" in one tag and id="a" in a second tag on the same page. Whereas
you can have class="a" appear as many times on a page as you wish.

Jul 21 '05 #3
Thank you both very much!

Jul 21 '05 #4

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

Similar topics

5
by: Jan Pieter Kunst | last post by:
(apologies if this message is a duplicate -- my news server seems to have problems) Greetings, When using PHP 4, this: // ex. 1 class A { function A(&$obj) {
6
by: Chris S. | last post by:
I'm trying to make a graphical editor and browser for Pickled files. One aspect I'm not sure about is how to detect multiple references to the same data. For instance, say I had the Pickled...
7
by: Nick Zdunic | last post by:
I have a remotable object running in my host application. The host starts up and creates the object. Within a method to start the remote object doing its thing it creates an object. ...
11
by: Doug | last post by:
Is there any harm in passing an object into a method with the 'ref' keyword if the object is already a reference variable? If not, is there any benefit?
4
by: z_learning_tester | last post by:
I'm reading the MS press C# book and there seems to be a contradiction. Please tell me which one is correct, 1 or 2. Thanks! Jeff 1. First it gives the code below saying that it prints 0 then...
8
by: toton | last post by:
HI, One more small doubt from today's mail. I have certain function which returns a pointer (sometimes a const pointer from a const member function). And certain member function needs reference...
15
by: arnuld | last post by:
-------- PROGRAMME ----------- /* Stroustrup, 5.6 Structures STATEMENT: this programmes *tries* to do do this in 3 parts: 1.) it creates a "struct", named "jd", of type "address". 2. it...
68
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a...
12
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.