Forum Moderators: not2easy

Message Too Old, No Replies

Making up your own tags defined by css?

ie: <blah>sometext</blah>

         

Br3nn4n

8:58 am on Feb 16, 2008 (gmt 0)

10+ Year Member



I saw this on another topic here, but now I'm wondering...in HTML/CSS, when you do something like this:

<style type="text/css">
.sideBar blah {
float: right;
width: 200px;
color: #565FED;
}
</style>

...can you then use that css block like so?


<div class="sideBar">
<blah>This is text</blah>
<blah>This is also text</blah>
</div>

Thing is, this seems completely wrong to me so now I'm wondering. How does .sideBar somethinghere work?

Stomme_poes

10:13 am on Feb 16, 2008 (gmt 0)

10+ Year Member



Ah, your title of your thread seems to suggest you meant inventing new html tags? Which the answer to is NO-- but you can in XML : )

But the way you have the code set up in your example, yes, that's how you'd refer to a child of something.


<style type="text/css">
.sideBar p {
float: right;
width: 200px;
color: #565FED;
}
</style>

<div class="sideBar">
<p>This is text</p>
<p>This is also text</p>
</div>


And of course, if you wanted a div called "blah"...
<div id="blah">
stuff...
</div>

CSS
#blah {
stuff...
}

But if you wanted a tag called <blah> you'd need XML... which IE doesn't understand on web pages : ) But maybe someday in the distant future...

*Edit what's up with these code tags, they're totally making my code unreadable! Where's my whitespace? *

[edited by: Stomme_poes at 10:15 am (utc) on Feb. 16, 2008]