HighDots Forums  

Style, But No Class

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Style, But No Class in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
pbd22
 
Posts: n/a

Default Style, But No Class - 08-23-2007 , 09:31 PM







In a manner of speaking.

I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?

Thanks.


Reply With Quote
  #2  
Old   
John Hosking
 
Posts: n/a

Default Re: Style, But No Class - 08-23-2007 , 09:46 PM






pbd22 wrote:
Quote:
In a manner of speaking.
Cute.
Quote:
I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?
For example:
body { color, background, margins, etc. for the body }
h1 { styling for the h1's }
h2 { styling for the h2's }
p, td { fontfaces for these text items }
ul li ul li {positioning for second-level navbar list items }
etc.

Also, for some if not all browsers:
h2 + h2 { some bizarre styling for the second (and subsequent) h2 }
div > p ( formatting for paragraphs which are children of a div }
etc.

And if it's not violating the spirit of your question:
ul { background color for all unordered lists }
ul#navbar { background color for the one nav unordered list }
ul#navbar li { more styling for nav items }
etc. (using id attributes, not classes)

So, why are you wondering this? Don't you wanna have no class?

--
John
Pondering the value of the UIP: http://blinkynet.net/comp/uip5.html


Reply With Quote
  #3  
Old   
Sanders Kaufman
 
Posts: n/a

Default Re: Style, But No Class - 08-23-2007 , 10:03 PM



pbd22 wrote:
Quote:
In a manner of speaking.

I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?
Each HTML element has an implicit "style" attribute.

So this:
Code:
<style>#MyClass H1 {position:absolute}</style> <h1 class="MyClass">Hello World</h1>

is functionally equivalent to this:
Code:
<h1 style="position:absolute">Hello World</h1>


Reply With Quote
  #4  
Old   
Nik Coughlin
 
Posts: n/a

Default Re: Style, But No Class - 08-23-2007 , 11:32 PM



pbd22 wrote:
Quote:
In a manner of speaking.

I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?
Sure, but you'll end up with a tacky little tramp of a page.




Reply With Quote
  #5  
Old   
Rob Waaijenberg
 
Posts: n/a

Default Re: Style, But No Class - 08-24-2007 , 02:34 AM



Nik Coughlin schreef:
Quote:
pbd22 wrote:
In a manner of speaking.

I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?

Sure, but you'll end up with a tacky little tramp of a page.


Assuming that we agree that tacky means tasteless,
are you implying that using classes guarantees good-looking pages?
And that the absence of classes will *always* result in tacky pages?

--
Rob Waaijenberg


Reply With Quote
  #6  
Old   
dorayme
 
Posts: n/a

Default Re: Style, But No Class - 08-24-2007 , 02:54 AM



In article <46ce8a91$0$226$e4fe514c (AT) news (DOT) xs4all.nl>,
Rob Waaijenberg <robwaaijenberg (AT) hotmail (DOT) com> wrote:

Quote:
Nik Coughlin schreef:
pbd22 wrote:
In a manner of speaking.

I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?

Sure, but you'll end up with a tacky little tramp of a page.



Assuming that we agree that tacky means tasteless,
are you implying that using classes guarantees good-looking pages?
And that the absence of classes will *always* result in tacky pages?
Rob! It was a joke. And a nice one. It did not have any deep
implications.

--
dorayme


Reply With Quote
  #7  
Old   
Rob Waaijenberg
 
Posts: n/a

Default Re: Style, But No Class - 08-24-2007 , 03:39 AM



dorayme schreef:
Quote:
In article <46ce8a91$0$226$e4fe514c (AT) news (DOT) xs4all.nl>,
Rob Waaijenberg <robwaaijenberg (AT) hotmail (DOT) com> wrote:

Nik Coughlin schreef:
pbd22 wrote:
In a manner of speaking.

I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?
Sure, but you'll end up with a tacky little tramp of a page.


Assuming that we agree that tacky means tasteless,
are you implying that using classes guarantees good-looking pages?
And that the absence of classes will *always* result in tacky pages?

Rob! It was a joke. And a nice one. It did not have any deep
implications.

Oh, I'm sorry.....

--
Rob Waaijenberg


Reply With Quote
  #8  
Old   
Andy Dingley
 
Posts: n/a

Default Re: Style, But No Class - 08-24-2007 , 10:49 AM



On 24 Aug, 03:31, pbd22 <dush... (AT) gmail (DOT) com> wrote:

Quote:
I just want to know if it is possible to style a page
without using the class attribute?
Of course. Pages "get styled" pretty much by default, even if they
don't take any deliberate design action. Class just makes this more
flexible.

CSS can also be placed in style attributes on each element. It's
trivial to prove that:

* (Almost) any web page with a stylesheet can have it replaced by
style attributes.
* Any non-trivial page would require so much work to do this that it's
entirely impractical.

(Actually there's a couple of things you can't do without a
stylesheet, such as using selectors like :hover, or media-specific
CSS)


CSS in stylesheets attaches itself to the elements by the application
of "selectors". These can use various items to identify the relevant
HTML: element names, class values or id values being the most
obvious.

If you want all <p> styled the same, then just use the element name "p
{ }".

If you want one <p id="foo" > to be different, you could use an id
"p#foo { }" (I'd still suggest class, but you certainly _could_ do
this).

If you want a recognisable set to be different, and the HTML structure
permits it, then you could use "div p { }" to identify only those <p>
that were inside a <div>.

If you want to address some set of <p> though, and none of the above
selectors are practical, then it's time to use a class. It's simple
to use and very flexible. You can even use it to hide the element type
such that ".warning {color: red;}" can be applied equally to <p
class="warning" > or <h1 class="warning" >. It's a great tool for all
CSS use.


So why are you wondering if you can avoid it?



Reply With Quote
  #9  
Old   
Good Man
 
Posts: n/a

Default Re: Style, But No Class - 08-24-2007 , 04:08 PM



pbd22 <dushkin (AT) gmail (DOT) com> wrote in news:1187922681.691672.62690
@i38g2000prf.googlegroups.com:

Quote:
In a manner of speaking.

I just want to know if it is possible to style a page
without using the class attribute? If so, how is this
done?
I like your subject line. Reminds me of my mother-in-law.


Reply With Quote
  #10  
Old   
Windsun
 
Posts: n/a

Default Re: Style, But No Class - 08-24-2007 , 04:09 PM



Sounds like my ex...


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.