473,786 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Style, But No Class


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.

Aug 24 '07 #1
9 2711
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?
Each HTML element has an implicit "style" attribute.

So this:
Expand|Select|Wrap|Line Numbers
  1. <style>#MyClass H1 {position:absolute}</style>
  2. <h1 class="MyClass">Hello World</h1>
  3.  
is functionally equivalent to this:
Expand|Select|Wrap|Line Numbers
  1. <h1 style="position:absolute">Hello World</h1>
  2.  
Aug 24 '07 #2
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.
Aug 24 '07 #3
Sanders Kaufman schrieb:
Expand|Select|Wrap|Line Numbers
  1. <style>#MyClass H1 {position:absolute}</style>
  2. <h1 class="MyClass">Hello World</h1>
  3.  
"#MyClass H1" selects H1 elements that are _descendants_ of _the_
element with the _id_ "MyClass", not h1 elements with _class_ "MyClass".

--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
Aug 24 '07 #4
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 Waaijenberg
Aug 24 '07 #5
In article <46************ *********@news. xs4all.nl>,
Rob Waaijenberg <ro************ @hotmail.comwro te:
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
Aug 24 '07 #6
dorayme schreef:
In article <46************ *********@news. xs4all.nl>,
Rob Waaijenberg <ro************ @hotmail.comwro te:
>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
Aug 24 '07 #7
On 24 Aug, 03:31, pbd22 <dush...@gmail. comwrote:
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 <pstyled 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 <pthough, 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?

Aug 24 '07 #8
pbd22 <du*****@gmail. comwrote in news:1187922681 .691672.62690
@i38g2000prf.go oglegroups.com:
>
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.
Aug 24 '07 #9
Sounds like my ex...

Aug 24 '07 #10

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

Similar topics

12
3835
by: David MacQuigg | last post by:
I have what looks like a bug trying to generate new style classes with a factory function. class Animal(object): pass class Mammal(Animal): pass def newAnimal(bases=(Animal,), dict={}): class C(object): pass C.__bases__ = bases dict = 0
13
2816
by: arreeess | last post by:
i wont used three styles in the element of a list; i have does so: <ul> <li> ............................. </li> first style <li> <p> .....................</p> </li> 2° style <li> <p class:"mystile">..... </p> </li> 3° style ... </ul> the call to class
9
12520
by: lkrubner | last post by:
How do I get all the div's on a page? I realize in IE I can use document.all. For the other browsers, I need to get an array of all the divs on the page. getElementByTagName()?????
3
1282
by: Kalle Anke | last post by:
I'm confused by the concepts of old-style vs new-style classes, I've read most of the documents I found about this but it doesn't "click". Probably because I wasn't around before 2.2. Anyway, the reason for new style classes are to make the whole type/object thing work better together. There are a number of new features etc. I think my problem is when new-style classes are used, at first I thought that all classes become new-style...
38
2056
by: looping | last post by:
For Python developers around. >From Python 2.5 doc: The list of base classes in a class definition can now be empty. As an example, this is now legal: class C(): pass nice but why this syntax return old-style class, same as "class C:", and not the new style "class C(object):" ?
1
15332
by: Armin Gajda | last post by:
Hi, I have the following problem: An input field get a border assigned by a style class (e.g. 2px solid red). When the field gets the focus, we set the border to green. element.style.border = "2px solid green"; When the field looses the focus, the border should change back to red.
13
2504
by: stephenpas | last post by:
We are trying to monkey-patch a third-party library that mixes new and old-style classes with multiple inheritance. In so doing we have uncovered some unexpected behaviour: <quote> class Foo: pass class Bar(object): pass
3
1922
by: Michellevt | last post by:
Hi I am working on a project (for college) and wondered if anyone can help me with my problem. In the project we are not allowed to make use of any "style" attributes but "class" attributes instead. The following is the java script that i am using and i am having trouble in using a class instead of a style tag because simply replacing the style=\"position:absolute;\" tag with class=\"posiAbs\" where in the external css ".posiAbs...
5
3752
by: Nathan Sokalski | last post by:
I have css that would normally be placed in style tags in the header of the Master page that I want to add programmatically for a specific Web Content Form (the *.aspx page). How do I do this for a Web Content Form? I cannot use style tags in a Web Content Form, and I am having trouble figuring out how to add all the desired css properties to a System.Web.UI.WebControls.Style object. Can anyone help me? Thanks. -- Nathan Sokalski...
0
9496
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
10164
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...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9961
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
8989
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
7512
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
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
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...
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.