Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inline styles depricated advice

Status
Not open for further replies.

0ddball

Technical User
Nov 6, 2003
208
GB
Apparently in the latest versions of XHTML the inline style="" attribute has been depricated.

Now I know it was always a naughty thing to use but it was REALLY helpful and nead to position things with it.

Now we're kind of stuck and could do with some advice.

We have a master stylesheet for our site - lets call it master.css.

We also have a page, lets say steve.aspx.

Now the elements on steve.aspx need laying out somehow and we don't like putting style in the header as it puts search engines off their dinner and looks butt ugly. It's called a style sheet so it should be stylish, right?

So we think of making a steve.css and applying that to the page - it would be nice if steve.css could extend master.css. We COULD import two style sheets into the page but that seems to mess up some of the validators out there and my collegue comes out in hives or something if they throw an error.

We can't seem to get the @import tag working atop another style sheet and I am begining to think we never will. I suspect it only works in <style></style> tags.

We also have a seperate problem that you folks probably don't want to know about - don't worry, it's nothing medical. We use ASP.net 2.0 master pages and can't for the life of us work out how to apply new style sheets to individual pages without making a theme for all of them and replicated master.css into it.

So - does anyone have any ideas on how we should be positioning things now we can't use inline elements?

Anyone know anything about Themes in asp.net?


Yet another unchecked rambling brought to you by:
Oddball
 
No, I haven't seen that anywhere either. I'd be surprised if it was true.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I mean - when you think about it - their goal is to seperate data from display.

Having inline styles in your structure document (the XHTML) violates this principle and means that changing the css file doesn't change the style of the entire site.

I guess it was always going to happen eventually.


Yet another unchecked rambling brought to you by:
Oddball
 
Well, count me in as being surprised then!

You're right in that it does make sense, but I thought it would remain a part of the flow e.g.

# External stylesheet
# Internal stylesheet
# Inline style

To take it out means that you would have to place everything within the internal stylesheet.

Personally, I haven't come across many situations where I've explicity needed to use an inline style but I can see that it may be needed occasionally.

As for your problem, you say:
We COULD import two style sheets into the page but that seems to mess up some of the validators out there
...
We can't seem to get the @import tag working atop another style sheet and I am begining to think we never will
I've just lifted this statement from the current app I'm working on, and this is what we've done with master sheets and themes:
Code:
		<style type="text/css"><!-- 
			@import "css/master_h2cf.css"; 
			@import "css/theme1.css"; 
		--</style>


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Oops...included some extra comment tags in my code, but you get the picture!


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
we don't like putting style in the header as it puts search engines off their dinner and looks butt ugly.

Not really.
Unless you have a HUGE stylesheet in there, which you probably shouldn't, it won't make any real difference.

It's fine to add some extra styles on a per document basis if you need it.

Failing that, create another stylesheet document and use it alongside your main one.

The @import directive should work fine, but yes it needs to be within <style> tags in the head of your document or called from within a stylesheet.

Foamcow Heavy Industries - Web design and ranting
Buy Languedoc wines in the UK
 
I don't really have any problems with it - I just thought I'd get this change out in the open and see if anyone has had any idea on how best to apply per-page styles.

The concencus seems to be applying per-page style in the header but once again this seems to violate the whole data/style seperation.

The problem I have with master pages is that short of creating a new theme for every page I can't specify which additional style sheet I would like to include for that page as there seems to be no programmatic way of doing this (I could write it direct to the stream but thats like buying a dog and barking yourself).

I can style the master page no problem with the normal XHTML style declarations but I can't change the header for the child pages.


Yet another unchecked rambling brought to you by:
Oddball
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top