Click here to get back home

style defining custom made tag: is this portable?: x {foo: bar} Hello world

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
style defining custom made tag: is this portable?: x {foo: bar} Hello world Bauke Jan Douma 07-08-2004
Get Chitika Premium
Posted by Bauke Jan Douma on July 8, 2004, 7:40 pm
Please log in for more thread options
Hi,

I am just starting to get familiar with all the ins and outs
of html.
I noticed that you can define a style, e.g.:

        x {color: green; font-weight: bold}

and then use <x> and </x> tags in your body. How convenient!

Question is, is this actually allowed under the W3C spec of
the latest version HTML, and is it portable across all/majority
of browers?

I couldn't find this as such answered when googling.
Using Linux/Mozilla, btw.

Thanks for you time.

-- thisbe


Posted by Els on July 8, 2004, 7:58 pm
Please log in for more thread options
Bauke Jan Douma wrote:

> Hi,
>
> I am just starting to get familiar with all the ins and
> outs of html.
> I noticed that you can define a style, e.g.:
>
> x {color: green; font-weight: bold}
>
> and then use <x> and </x> tags in your body. How
> convenient!

It's called CSS.
http://www.w3.org/TR/2004/CR-CSS21-20040225/

And you can't just use <x>, you need to use real html
elements.
http://www.w3.org/TR/html4/index/elements.html

> Question is, is this actually allowed under the W3C spec of
> the latest version HTML, and is it portable across
> all/majority of browers?

Portable, yes. But not all styles are supported in every
browser. Especially IE isn't completely standards compliant.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -


Posted by David Dorward on July 8, 2004, 9:00 pm
Please log in for more thread options
Bauke Jan Douma wrote:

> x {color: green; font-weight: bold}
>
> and then use <x> and </x> tags in your body.
>
> Question is, is this actually allowed under the W3C spec of
> the latest version HTML

No. (Although if you were using a custom XML language you could do this
(making sure you served it as something other then text/html)).

> , and is it portable across all/majority of browers?

No.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Posted by Andy Dingley on July 9, 2004, 3:33 am
Please log in for more thread options
bjdouma@xs1.xs4all.nl (Bauke Jan Douma) wrote in message

> I noticed that you can define a style, e.g.:
>
>         x {color: green; font-weight: bold}
>
> and then use <x> and </x> tags in your body. How convenient!

This isn't permitted.

Don't mess with the tags in HTML. Use the set you were given and no
others.

If you _really_ want to do this, then switch to XHTML and use XML
namespacing. This is now perfectly valid (as XML), but it stretches
the boundaries of what's seen as acceptable HTML by most browsers and
validators. It'll give you problems.

The real way to do this is with compliant HTML, using the <span> and
<div> elements, but add a class attribute to them. You now have code
like this:

.x {color: green; font-weight: bold; }

<p>A paragraph with a <span class="x" >green</a> word.</p>


To make this work well, red the HTML specification and the DTD, and
get the distinction cleaqr in your mind about <span>, <div> and the
difference between block and inline elements.


Posted by Els on July 9, 2004, 10:36 am
Please log in for more thread options
Andy Dingley wrote:

> .x {color: green; font-weight: bold; }
>
> <p>A paragraph with a <span class="x" >green</a>
> word.</p>

Just swap that </a> for a </span> ;-)

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -


Similar ThreadsPosted
Save your world November 25, 2005, 8:20 pm
Post Meta World? September 2, 2005, 3:12 am
The world is really unstable these days...... May 15, 2005, 7:31 pm
Re: Set a Guinness World Record with new Firefox 3.0 June 16, 2008, 3:04 pm
Writing a "Hello world" HTML page from perl script ? June 11, 2006, 4:00 am
XHTML DOCTYPE breaks JavaScript x.style.top and x.style.left? July 5, 2005, 12:58 pm
How is this website made???? August 26, 2004, 6:30 am
Defining my own new attributes? August 20, 2005, 11:45 am
Is the website made ok this time? February 10, 2005, 8:02 pm
Defining August 5, 2004, 1:56 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap