473,320 Members | 1,991 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,320 software developers and data experts.

Class an ID syntax

Ok

i know now that i use a class if elements repeat. And i can use an ID if
they are unique.

I now have a problem.

With ID all is well, but does not validate. So i have to rewrite the
code... but how? I am confused with all the "." and "#". What is the
correct syntax (if any?)

Mark

<part code>
#info {
width:320px;
padding:0;
margin:0;
float:right;
}

#info .omschrijving {
margin:0;
padding:0px 30px 20px 10px;
width:270px;
font-size:75%;
}

#info h2 {
margin:0;
padding:0 0 10px 0px;
width:320px;
}
</part code>
------------------------------------------
<part code html>
<div id="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div id="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part code html>

-------------------------------------------
-------------------------------------------
This does not work:

<part new code html>
<div class="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div class="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part new code html>

------------------------------------------
<new css>

..info {
}

..info .omschrijving {

}

..info h2 {

}

</new css>

Aug 18 '05 #1
14 1722
Mark wrote:
Ok

i know now that i use a class if elements repeat. And i can use an ID if
they are unique.

I now have a problem.

With ID all is well, but does not validate. So i have to rewrite the
code... but how? I am confused with all the "." and "#". What is the
correct syntax (if any?)

[snip]

-------------------------------------------
This does not work:

<part new code html>
<div class="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div class="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part new code html>

------------------------------------------
<new css>

.info {
}

.info .omschrijving {

}

.info h2 {

}

</new css>


Looks correct to me. Can you give the URL to a complete document, perhaps
the problem is burries somewhere else.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Aug 18 '05 #2
Benjamin Niemann wrote:
Mark wrote:

Ok

i know now that i use a class if elements repeat. And i can use an ID if
they are unique.

I now have a problem.

With ID all is well, but does not validate. So i have to rewrite the
code... but how? I am confused with all the "." and "#". What is the
correct syntax (if any?)

[snip]

-------------------------------------------
This does not work:

<part new code html>
<div class="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div class="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part new code html>

------------------------------------------
<new css>

.info {
}

.info .omschrijving {

}

.info h2 {

}

</new css>

Looks correct to me. Can you give the URL to a complete document, perhaps
the problem is burries somewhere else.


Ok, i think there is something else wrong, so here is the URL:

The red background is not going to stay, but a little help. The text
has to be in this arrea.

For the green arrea: here has to be the title (<h2>)

http://www.keyone.nl/lab/beeldlijn/nl/collection.asp

I hope you can help me out!
Thanks
Mark

Aug 18 '05 #3
<snip>

I did solve it :0)

Because the classes where in a div (#dvd), i had to extend my definitions.

So, instead of

..winkelwagen

#dvd .winkelwagen

etc.

Mark

Aug 18 '05 #4
Els
Mark wrote:
<snip>

I did solve it :0)

Because the classes where in a div (#dvd), i had to extend my definitions.

So, instead of

.winkelwagen

#dvd .winkelwagen

etc.


Being that specific is only needed if the style needs to override a
previous style that is more specific than just .winkelwagen.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Steppenwolf - The Ostrich
Aug 18 '05 #5
Mark wrote:
http://www.keyone.nl/lab/beeldlijn/nl/collection.asp


An unrelated issue: you declared the encoding as 'iso-8859-1', but you are
actually using 'windows-1252'. Some browsers may render e.g. the euro sign
as you intended, others will render it correctly (not at all, or with a
placeholder for non-printable characters, usually a boxshape).

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Aug 19 '05 #6
Els wrote:
Mark wrote:

<snip>

I did solve it :0)

Because the classes where in a div (#dvd), i had to extend my definitions.

So, instead of

.winkelwagen

#dvd .winkelwagen

etc.

Being that specific is only needed if the style needs to override a
previous style that is more specific than just .winkelwagen.


I am not sure what you mean by this. Can you explain it a bit more?

thanks,
mark

Aug 19 '05 #7
Benjamin Niemann wrote:
Mark wrote:

http://www.keyone.nl/lab/beeldlijn/nl/collection.asp

An unrelated issue: you declared the encoding as 'iso-8859-1', but you are
actually using 'windows-1252'. Some browsers may render e.g. the euro sign
as you intended, others will render it correctly (not at all, or with a
placeholder for non-printable characters, usually a boxshape).


Thanks.
Is it okay just to change it into windows-1252 or do i need to know more
about it?

Mark

Aug 19 '05 #8
Els
Mark wrote:
Els wrote:
Mark wrote:
I did solve it :0)
Because the classes where in a div (#dvd), i had to extend my definitions.
So, instead of
.winkelwagen
#dvd .winkelwagen
etc.


Being that specific is only needed if the style needs to override a
previous style that is more specific than just .winkelwagen.


I am not sure what you mean by this. Can you explain it a bit more?


There normally is no need to add #dvd just because .winkelwagen is
inside #dvd.

Example (off the top of my head, not tested, just an example):

<div id="content">
<p class="text">bla bla bla bla</p>
<p class="more">more more more more</p>
</div>

If you have set a style in your css like:
#content p{background:red;}

then just:
.text{background:blue;}
won't work.

"#content p" is more specific than ".text", and the blue background
will be ignored in favour of the red background that was set.

In that case, to 'supercede' the set red background, you'll need:
#content p.text{background:blue;}
to make it work.

HTH

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: The Eagles - Hotel California
Aug 19 '05 #9
Mark wrote:
Benjamin Niemann wrote:
Mark wrote:

http://www.keyone.nl/lab/beeldlijn/nl/collection.asp

An unrelated issue: you declared the encoding as 'iso-8859-1', but you
are actually using 'windows-1252'. Some browsers may render e.g. the euro
sign as you intended, others will render it correctly (not at all, or
with a placeholder for non-printable characters, usually a boxshape).


Thanks.
Is it okay just to change it into windows-1252 or do i need to know more
about it?


Declaring the charset as windows-1252 would be the the easiest fix and
should probably work on all major browsers. But people may argue that
windows-1252 is 'bad', because it is a proprietary, vendor specific
character set - in contrast to iso-* or unicode.
If you prefer a vendor neutral character set, stay with iso-8859-1 and use
character references for characters not in iso-8859-1 (e.g. &#x201a; for
the euro sign). validator.w3.org will tell you which characters are illegal
in iso-8859-1 and you can use
<http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT>
to map these to the correct unicode codepoints.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Aug 19 '05 #10
On Fri, 19 Aug 2005, Mark wrote:
Is it okay just to change it into windows-1252


Windows-1252 is a Microsoft proprietary encoding - in practice, most
web clients will support this encoding, but some recipients would
consider it rude of you to transmit www pages in a proprietary
encoding - even if their software supports it.

Based on what you currently seem to be doing, I'd recommend sending
iso-8859-1, and representing any characters which are not in that
encoding using &-notation, e.g &euro;

If you're extruding this HTML from some proprietary MS software, as it
appears may be the case, then you'd need to find out more about how to
get that software under control! I, like many another here, can
advise you on what would be correct CSS, HTML etc., but this isn't
really the place to learn how to use proprietary applications which
are extruding faulty web formats...

You can, normally, identify which characters these are by submitting
your HTML to the W3C's validator (validator.w3.org): it will throw a
warning on any characters that it dislikes, including Windows-1252
characters when your document was advertised as iso-8859-1.
http://validator.w3.org/check?verbos...collection.asp

You have a handful of such errors reported, not only the coded
character 128 decimal (euro) but also 146, 147, 148, and 149. Looks
like Windows-1252 "smart" single and double quotes (one learns that
whenever MS say "smart", it's going to be dumb).

If you want to explore other options, I offer quite a lot of
discussion (probably a lot more than you want/need, but take as
much as you care to) about various possibilities here:
http://ppewww.ph.gla.ac.uk/~flavell/charset/checklist

hope this helps.
Aug 19 '05 #11
On Fri, 19 Aug 2005, Benjamin Niemann wrote:
If you prefer a vendor neutral character set, stay with iso-8859-1 and use
character references for characters not in iso-8859-1 (e.g. &#x201a; for
the euro sign).


Decimal character references like ‚ (single quote low-9) and
€ (euro) are better supported. In the special case "euro sign",
it is still better to use the entity &euro; .

--
I used to believe in reincarnation in a former life.

Aug 19 '05 #12
Alan J. Flavell wrote:
On Fri, 19 Aug 2005, Mark wrote:

Is it okay just to change it into windows-1252

Windows-1252 is a Microsoft proprietary encoding - in practice, most
web clients will support this encoding, but some recipients would
consider it rude of you to transmit www pages in a proprietary
encoding - even if their software supports it.

Based on what you currently seem to be doing, I'd recommend sending
iso-8859-1, and representing any characters which are not in that
encoding using &-notation, e.g &euro;

If you're extruding this HTML from some proprietary MS software, as it
appears may be the case, then you'd need to find out more about how to
get that software under control! I, like many another here, can
advise you on what would be correct CSS, HTML etc., but this isn't
really the place to learn how to use proprietary applications which
are extruding faulty web formats...

You can, normally, identify which characters these are by submitting
your HTML to the W3C's validator (validator.w3.org): it will throw a
warning on any characters that it dislikes, including Windows-1252
characters when your document was advertised as iso-8859-1.
http://validator.w3.org/check?verbos...collection.asp

You have a handful of such errors reported, not only the coded
character 128 decimal (euro) but also 146, 147, 148, and 149. Looks
like Windows-1252 "smart" single and double quotes (one learns that
whenever MS say "smart", it's going to be dumb).

If you want to explore other options, I offer quite a lot of
discussion (probably a lot more than you want/need, but take as
much as you care to) about various possibilities here:
http://ppewww.ph.gla.ac.uk/~flavell/charset/checklist

hope this helps.


Thanks, this helps!

There was some ' and " and bullets from some MS software indeed.

Good to know.

grtz

Aug 19 '05 #13
Mark wrote:
Els wrote:
Mark wrote:

<snip>

I did solve it :0)

Because the classes where in a div (#dvd), i had to extend my
definitions.

So, instead of

.winkelwagen

#dvd .winkelwagen

etc.


Being that specific is only needed if the style needs to override a
previous style that is more specific than just .winkelwagen.


I am not sure what you mean by this. Can you explain it a bit more?


Suppose you have the following HTML code:

<div id="foo">
<p class="bar" id="myself">Something</p>
</div>

Any of the following selectors could affect the appearance of the paragraph:

p
div p
p.bar
#myself
p#myself
div .bar
#foo .bar
#foo p
#foo p.bar
div#foo p

and so on. Suppose you have several of these in your stylesheets all of
which specify a value for the same CSS property. For example:

p { color: blue; }
#foo p { color: red; }
#myself { color: green; }
#foo .bar { color: black; }

How this conflict will be resolved--whether the paragraph will be
displayed in blue, red, green, black, or some other color--depends on
applying the cascade rules to the styles you've defined. A "priority" is
computed for each selector that specifies a particular property, and the
selector with the highest priority "wins". See

http://www.w3.org/TR/CSS21/cascade.html#cascade

Aug 19 '05 #14
begin quotation
from Mark <sc*****@xs4all.nl>
in message <43**************@xs4all.nl>
Benjamin Niemann wrote:
An unrelated issue: you declared the encoding as 'iso-8859-1', but you are
actually using 'windows-1252'.


Thanks.
Is it okay just to change it into windows-1252 or do i need to know more
about it?


I cannot in good faith recommend any use of encodings proprietary to
Microsoft products in a World Wide Web context. It would be best to
re-encode as iso-8859-1.

--
___ _ _____ |*|
/ __| |/ / _ \ |*| Shawn K. Quinn
\__ \ ' < (_) | |*| sk*****@speakeasy.net
|___/_|\_\__\_\ |*| Houston, TX, USA
Aug 19 '05 #15

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

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
3
by: PF | last post by:
Hello, I'm pleased to see activity on this topic as it pains me to write "classmethod" two pages of code after the method definition. However I find the decorators to obfuscate the syntax and...
18
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I...
2
by: bor_kev | last post by:
Hi, First of all, i want to use the new managed class syntax and STL.NET under Microsoft Visual (C++) Studio 2005 Beta. I read in a Microsoft...
5
by: Dylan Moreland | last post by:
I'm trying to implement a bunch of class methods in an ORM object in order to provide functionality similar to Rails' ActiveRecord. This means that if I have an SQL table mapped to the class...
1
by: ligong.yang | last post by:
Hi all, I got tortured by a very weird problem when I was using k. wilder's random generator class in my program. PS: wilder's generator class can be found at...
10
by: =?iso-8859-2?B?SmFuIFJpbmdvuQ==?= | last post by:
Hello everybody, this is my first post to a newsgroup at all. I would like to get some feedback on one proposal I am thinking about: --- begin of proposal --- Proposal to add...
5
by: Marcin Gil | last post by:
Hi! I have the code like this (obvious things like ctor/dtor removed) typedef struct _NODE { int val; int index; } Node;
9
by: gopal | last post by:
Why is ; ~ semi-colon used at the end of class definition ? Thanks JK
7
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.