473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
Jul 20 '05 #1
5 1470
Els
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 -
Jul 20 '05 #2
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
Jul 20 '05 #3
bj*****@xs1.xs4all.nl (Bauke Jan Douma) wrote in message news:<40***********************@news.xs4all.nl>...
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.
Jul 20 '05 #4
Els
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 -
Jul 20 '05 #5
Els wrote:
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> ;-)


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! =-----
Jul 20 '05 #6

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

Similar topics

4
by: Guillaume CABANAC | last post by:
Hi everybody, Does anybody know how to access a remote database (say Oracle) from JavaScript code (within a Firefox Extension) ? I know ADO via ActiveX in the IE world and think a similar...
2
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
4
by: Steve Kallal | last post by:
I am relatively new to the world of ASP .NET programming. So I really don't understand much of the code in the WebForms HTML View. The rendering "<%# %>" syntax does not make much sense to me. I...
3
by: | last post by:
I have been researching articles on google on how to create a simple RSS feed that sucks <title><blurb><link><date> out of a sql server 2000 database via an aspx page. I know it has to be pushed...
3
by: Philippe Lang | last post by:
Hello, Does anyone have experience in interfacing a Postgresql database (tables? plpgsql functions? perl functions?) with the outside world through webservices? (XML-RPC, SOAP, UDDI, WSDL...) ...
8
by: Brian P | last post by:
I want to expose a property of Dictionary<string, MyAbstractClass>. I tried to do it this way: private Dictionary<string, MyChildClass> _dictionary; public Dictionary<string,...
4
by: Dave Booker | last post by:
So did the .NET 2.0 working group just run out of steam before it got to a ReadOnlyDictionary<> wrapper? I am publishing events containing a SortedList<>, and obviously I don't want event...
6
by: asdf | last post by:
It is best to show me some examples. Thanks a lot.
15
by: Grizlyk | last post by:
Hello. Returning to question of manual class type identification, tell me, for ordinary inheritance is C++ garantee that dynamic_cast<Derived*>(Base*) can be implemented similarly to ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.