MrBill@ SNL.LV said:
Thanks David,
Uh Oh, I hope you read the first post about being new to all of this. You
asked me if I had a URL so that you could see what I was trying to
acheive. Well, let me try and answer this question... no. Now I have to
ask another one. I know what a URL is (i.e. a Universal Resource
Identifier) and I know what it is for too. I am guessing that I could
use my free Netscape web page space to acheive having one and FTP the
files to it, then provide a link to it when I need to when I ask a
question in this forum? Well there is the question. If the answer to
the question is yes, then it will take me some time to figure out how to
DO all of those things I just said!
Interesting that the style sheet will see both of the class IDs, unless
I think you should be careful with your terminology. A class and an id are
different things used in different ways for different purposes.
example, in your stylesheet:
p.main {border: 2px solid red;} [1]
p#footer {border: 2px solid green;}
Then in the html source:
<p class="main">This is text in a paragraph with the main type of text which
has a red border around it</p>
<p class="main">This is text in a paragraph with the main type of text which
has a red border around it</p>
<p class="main">This is text in a paragraph with the main type of text which
has a red border around it</p>
<p class="main">This is text in a paragraph with the main type of text which
has a red border around it</p>
<p id="footer">This text is in a paragraph in the footer,it has a green
border around it, it can be used only once</p>
Note how a class can be used as many times as you like but an id must be
unique and can therefore be used only once. Note also that an id is
preceeded by a hash symbol in the css and a class is preceeded with a
period.
one is a specific class ID (like class= img.imgalgntop) which is similar
to what I was trying to use in this case.
You would not write it like your example above. It would be like this:
<img class="imgalgntop" blah blah...........>
The more specific selector i.e. img.imgalgntop {properties:values
here;etc........
will always take presedence over less specific selectors like
..imgalgntop {properties:values here;etc........ (this is less specific as
it does not name an element to use the class with)
BTW - A selector with an id has a very high specificity and an inline style
always wins over external stylesheets regardless of specificity. MY point
above applies well all else is equal i.e. the style rules are both in an
external stylesheet
I tried it for a few days and
couldn't get it to do anything! I must have been doing something wrong
huh?! Then another question comes to mind. Is it bad form to use the
in-line style like I have done? CSE says to use in-line styles
sparingly, but does not say don't use them at all.
Thanks again,
Mr. Bill
In-line style is considered to be a bad way to use CSS because it doesn't
take advantage of the benefits that CSS brings. One of the many advantages
of CSS is a single stylesheet can affect many pages but if you use inline
style or put the style in the head of the html page then you obviously lose
this feature. Another bad thing is you end up with a lot of CSS scattered
throughout your pages, its easy to forget where all the CSS is.
I recommend using WS FTP Pro for uploading your files to your hosts server -
very easy to use. Basically there is a 'windows explorer like pane' on the
left of the interface and you just high light the files you want to upload
and hit the upload arrow and away they go!
[1] - if you leave off the element <p> in this case, then you can apply the
class to any element such as <ul> or <ol>
BTW - I am 43 and have been at this now for about 3 years. I am trying to
set up my own web desiqn business because no one will employ you in I.T.
unless you have experience and being over 40 is a big handicap - I note
there is legislation coming out to outlaw ageism - don't know if that will
help but its good in principle.
I wish you luck - it does sink in eventually - but it does require many
hours of study
HTH
Dvaid