Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 08:17 PM
Bauke Jan Douma
Guest
 
Posts: n/a
Default style defining custom made tag: is this portable?: x {foo: bar} <x>Hello world</x>

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
  #2  
Old July 20th, 2005, 08:17 PM
Els
Guest
 
Posts: n/a
Default Re: style defining custom made tag: is this portable?: x {foo: bar} <x>Hello world</x>

Bauke Jan Douma wrote:
[color=blue]
> 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![/color]

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
[color=blue]
> Question is, is this actually allowed under the W3C spec of
> the latest version HTML, and is it portable across
> all/majority of browers?[/color]

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 -
  #3  
Old July 20th, 2005, 08:17 PM
David Dorward
Guest
 
Posts: n/a
Default Re: style defining custom made tag: is this portable?: x {foo: bar} <x>Hello world</x>

Bauke Jan Douma wrote:
[color=blue]
> 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[/color]

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)).
[color=blue]
> , and is it portable across all/majority of browers?[/color]

No.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
  #4  
Old July 20th, 2005, 08:17 PM
Andy Dingley
Guest
 
Posts: n/a
Default Re: style defining custom made tag: is this portable?: x {foo: bar} <x>Hello world</x>

bjdouma@xs1.xs4all.nl (Bauke Jan Douma) wrote in message news:<40ed9524$0$36169$e4fe514c@news.xs4all.nl>...
[color=blue]
> 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![/color]

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.
  #5  
Old July 20th, 2005, 08:17 PM
Els
Guest
 
Posts: n/a
Default Re: style defining custom made tag: is this portable?: x {foo: bar} <x>Hello world</x>

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

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

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
  #6  
Old July 20th, 2005, 08:18 PM
Matt
Guest
 
Posts: n/a
Default Re: style defining custom made tag: is this portable?: x {foo: bar} <x>Hello world</x>

Els wrote:
[color=blue]
> Andy Dingley wrote:
>[color=green]
>> .x {color: green; font-weight: bold; }
>>
>> <p>A paragraph with a <span class="x" >green</a>
>> word.</p>[/color]
>
> Just swap that </a> for a </span> ;-)[/color]

In fact, if that class is supposed to emphasise the word 'green' then this
is much better:

<p>A paragraph with a <strong class="x">green</strong> word.</p>
..x {color: green; font-weight: bold; }
(the font-weight is unnecessary here)

Or even

<p>A paragraph with a <strong>green</strong> word.</p>
strong {color: green; font-weight: bold; }

--
Matt


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
 

Bookmarks

Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles