Personal computing discussed

Moderators: renee, SecretSquirrel, just brew it!

 
Flying Fox
Gerbil God
Topic Author
Posts: 25690
Joined: Mon May 24, 2004 2:19 am
Contact:

What can I do without the SPAN tag?

Thu Jul 28, 2005 10:33 am

The other day I was looking at what so hot about HTML-Strict. The one big thing is the absence of the SPAN tag. I tend to use a lot of it to apply custom styles.

Does that mean if I am going to create HTML-Strict pages, I am screwed? Or is there an alternative(s)?
 
steelcity_ballin
Gerbilus Supremus
Posts: 12072
Joined: Mon May 26, 2003 5:55 am
Location: Pittsburgh PA

Thu Jul 28, 2005 10:55 am

Hmm. Well seeing as the Div tag im guessing is out due to its paragraph breaking tendencies, Im not too sure. Can I see what you are working on? It may help.
 
Kevin
Administrator
Posts: 6581
Joined: Thu Dec 27, 2001 7:00 pm
Location: Minneapolis, MN
Contact:

Thu Jul 28, 2005 1:49 pm

Is there a reason you're restricting yourself to the HTML strict doctype?
Being right doesn't matter if no one listens.
 
mattsteg
Gerbil God
Posts: 15782
Joined: Thu Dec 27, 2001 7:00 pm
Location: Applauding the new/old variable width forums
Contact:

Thu Jul 28, 2005 1:54 pm

Is there a reason you want to apply styles that aren't attached to a distinct contextual element? SPAN doesn't really have any meaning, I'm just curious what you would need to format differently from other related stuff but isn't logically separate.
...
 
steelcity_ballin
Gerbilus Supremus
Posts: 12072
Joined: Mon May 26, 2003 5:55 am
Location: Pittsburgh PA

Thu Jul 28, 2005 2:01 pm

Kevin wrote:
Is there a reason you're restricting yourself to the HTML strict doctype?


If he is using an editor, it's likely pregenerated. I believe Dreamweaver (my editor of choice) does this as well.
 
Flying Fox
Gerbil God
Topic Author
Posts: 25690
Joined: Mon May 24, 2004 2:19 am
Contact:

Thu Jul 28, 2005 2:13 pm

Well, it was just a curious side-research that I was doing since I saw that MSN was trying to go Strict (straight? :)). Just want to see what the fuss is all about, and what can I do by going further than transitional.

As for SPAN uses, well, I typically use it to look alike the styles are more contextual:
The product name of this is <span class="product_name">My Product &reg;</span>.  Blah blah blah...
Kind of making inline styles without using "ugly" (IMHO) b's and u's. Then I will define the class in my stylesheet.

And as pete_roth said, div usually involves a break so inlining is no good.
 
mattsteg
Gerbil God
Posts: 15782
Joined: Thu Dec 27, 2001 7:00 pm
Location: Applauding the new/old variable width forums
Contact:

Thu Jul 28, 2005 2:59 pm

Flying Fox wrote:
As for SPAN uses, well, I typically use it to look alike the styles are more contextual:
The product name of this is <span class="product_name">My Product &reg;</span>.  Blah blah blah...
Kind of making inline styles without using "ugly" (IMHO) b's and u's. Then I will define the class in my stylesheet.

And as pete_roth said, div usually involves a break so inlining is no good.
Where did you see that span is disallowed anyway? Sure looks to me like it's still in in all the "difference between strict and transitional" pages I see. You just aren't supposed to drop it or other similar tags straight into the body etc. Alternatives would be to style appropriate strong or em tags accordingly, and they would be contextually more meaningful as well.
...
 
madlemming
Gerbil XP
Posts: 341
Joined: Fri Oct 15, 2004 2:22 pm

Thu Jul 28, 2005 3:04 pm

What's your validation target? And also, when was span depreciated... I've been using it in HTML 4.01 strict and xhtml 1.1 strict and it validates fine. With a quick skim I can't find where in those specs span is marked as depreciated.

Also, you can force div's or any other element to display inline by styling it as "display: inline;"
 
steelcity_ballin
Gerbilus Supremus
Posts: 12072
Joined: Mon May 26, 2003 5:55 am
Location: Pittsburgh PA

Thu Jul 28, 2005 3:35 pm

madlemming wrote:
What's your validation target? And also, when was span depreciated... I've been using it in HTML 4.01 strict and xhtml 1.1 strict and it validates fine. With a quick skim I can't find where in those specs span is marked as depreciated.

Also, you can force div's or any other element to display inline by styling it as "display: inline;"


I thought Div forced the paragraph break anyhow, regardless of the inline property or not.
 
excession
Graphmaster Gerbil
Posts: 1262
Joined: Fri Dec 31, 2004 3:19 pm
Location: Nottingham, UK

Thu Jul 28, 2005 3:40 pm

what's wrong with

em.red { color:red; }


This bit of text is <em class="red">RED</em>.


and turn off boldening and italicizing in the CSS.
i5-4670 | Asus H87M-E | MSI GTX 960 | 8GB DDR3 @800 | WD Green 2TB | 850 EVO 250GB | CM Masterkeys Pro L White | MX518 (original!) | Hyper 212 Evo | 6TB Ubuntu/ZFS NAS
I was going to tell a Chemistry joke, but all the good ones argon.
 
madlemming
Gerbil XP
Posts: 341
Joined: Fri Oct 15, 2004 2:22 pm

Thu Jul 28, 2005 4:11 pm

I thought Div forced the paragraph break anyhow, regardless of the inline property or not.


You're right, setting it to inline gets rid of the line-break after, but not the line-break before. Bizzare.
 
steelcity_ballin
Gerbilus Supremus
Posts: 12072
Joined: Mon May 26, 2003 5:55 am
Location: Pittsburgh PA

Thu Jul 28, 2005 4:16 pm

madlemming wrote:
I thought Div forced the paragraph break anyhow, regardless of the inline property or not.


You're right, setting it to inline gets rid of the line-break after, but not the line-break before. Bizzare.


Yea I ran into that problem awhile back myself. I had these little holes in my layout and couldn't for the life of me figure it out until I read the actual description of div. Heh weird world of web stuff.
 
Flying Fox
Gerbil God
Topic Author
Posts: 25690
Joined: Mon May 24, 2004 2:19 am
Contact:

Thu Jul 28, 2005 7:40 pm

mattsteg wrote:
Where did you see that span is disallowed anyway? Sure looks to me like it's still in in all the "difference between strict and transitional" pages I see. You just aren't supposed to drop it or other similar tags straight into the body etc.
Yeah, that's basically what I found out, from those "differences" pages. So are you saying that the latest and greatest specs on Strict allows the tag now?

excession wrote:
what's wrong with
em.red { color:red; }
This bit of text is <em class="red">RED</em>.

and turn off boldening and italicizing in the CSS.
Doh! Thanks! Goes to show I am really not a web guy (never read any books, just self-taught and the odd web tutorial here and there). Should've gone back to C/C++/C#... until I hit ASP.NET anyways. So many times I have to clean up WYSIWYG messes left behind by people who are worse than me (both HTML and C#). :-?

And about the div inlining: I don't recall ever reading that div is supposed to have link breaks. I will assume this should be overridable. Could it be a browser problem (FF having to follow IE somewhat so it has to follow the same "mistake")?
 
mattsteg
Gerbil God
Posts: 15782
Joined: Thu Dec 27, 2001 7:00 pm
Location: Applauding the new/old variable width forums
Contact:

Thu Jul 28, 2005 8:19 pm

Flying Fox wrote:
Yeah, that's basically what I found out, from those "differences" pages. So are you saying that the latest and greatest specs on Strict allows the tag now?
My interpretation is that they want all your text, chunkc of text, etc. wrapped up in <p>, <div>, etc. They don't want text straight in the body and they thus don't want tags used to format inline text not in a <p>, <div> etc. That doesn't mean that the tags themselves are deprecated. FWIW <em> has the same new restrictions on it.
...
 
Flying Fox
Gerbil God
Topic Author
Posts: 25690
Joined: Mon May 24, 2004 2:19 am
Contact:

Thu Jul 28, 2005 10:23 pm

mattsteg wrote:
Flying Fox wrote:
Yeah, that's basically what I found out, from those "differences" pages. So are you saying that the latest and greatest specs on Strict allows the tag now?
My interpretation is that they want all your text, chunkc of text, etc. wrapped up in <p>, <div>, etc. They don't want text straight in the body and they thus don't want tags used to format inline text not in a <p>, <div> etc. That doesn't mean that the tags themselves are deprecated. FWIW <em> has the same new restrictions on it.
Just looked it up again. <em> is no go as well. Damn. :(

So what can you do if you want Strict but still want inline tagging of texts within the body then? Semantically it is a valid case. In a document if you are referring to "keywords", then you should be able to highlight them inline?
 
mattsteg
Gerbil God
Posts: 15782
Joined: Thu Dec 27, 2001 7:00 pm
Location: Applauding the new/old variable width forums
Contact:

Thu Jul 28, 2005 10:57 pm

Flying Fox wrote:
Just looked it up again. <em> is no go as well. Damn. :(

So what can you do if you want Strict but still want inline tagging of texts within the body then? Semantically it is a valid case. In a document if you are referring to "keywords", then you should be able to highlight them inline?
I keep trying to say this, but I guess I'm not being clear enough. You can use them, they just shouldn't be child elements in the body. All your text should be in <p>, <div>, etc. tags within the body. Saying not to use a laundry list of tags as children of <body> is just the consequence of that.

All they're saying is don't stick plain (or visually styled) text directly in the <body>, encapsulate it in a semantically meaningful way.
...
 
Flying Fox
Gerbil God
Topic Author
Posts: 25690
Joined: Mon May 24, 2004 2:19 am
Contact:

Fri Jul 29, 2005 9:24 am

mattsteg wrote:
I keep trying to say this, but I guess I'm not being clear enough. You can use them, they just shouldn't be child elements in the body. All your text should be in <p>, <div>, etc. tags within the body. Saying not to use a laundry list of tags as children of <body> is just the consequence of that.

All they're saying is don't stick plain (or visually styled) text directly in the <body>, encapsulate it in a semantically meaningful way.
From what I read is that they said it cannot be a "child" of body. So if there is more than 1 levels of "inheritance" it is ok?
<body>
  <p>
    Blah blah <span>special</span>.
  </p>
</body>
My initial thought was in the entire chain, not just one level down. Guess I was reading the stuff wrong then. Wasn't a serious research anyway as I knew I will be using transitional for the forseeable future. :P
 
mattsteg
Gerbil God
Posts: 15782
Joined: Thu Dec 27, 2001 7:00 pm
Location: Applauding the new/old variable width forums
Contact:

Fri Jul 29, 2005 9:58 am

Flying Fox wrote:
My initial thought was in the entire chain, not just one level down. Guess I was reading the stuff wrong then. Wasn't a serious research anyway as I knew I will be using transitional for the forseeable future. :P
Well, since there are only restrictions listed for the tags (implying they still exist) and they're not useful anywhere except in the body, I kinda figured it had to work that way. Definately confusing the way it's presented though.
...

Who is online

Users browsing this forum: No registered users and 15 guests
GZIP: On