While I'm learning and testing CSS examples I find it a big nuisance to constantly scroll back and forth between content and styling. It looks like inline styles only work with elements but I'm hoping there is a way to make them work with classes.
0sync0, that's why most people put styles in a separate file, you can then just switch between two open windows, or depending on your editor, two open tabs.
Every fight is a food fight when you’re a cannibal.
If you want to do the styling inline, it is no use and maybe even counterproductive to give elements (= everything in the <body> except scripts) a className. Just use <div style="">, <p style="">, etc.
But I would strongly recommend to use style blocks or external style sheets. With a proper editor (www.htmlkit.com, build 292 is good and free) you can indeed easily switch between tabs, as David suggested.
And when you use a style block, you can jump to the top of the code file with Ctrl + Home, and to the bottom with Ctrl + End.
If you want to do the styling inline, it is no use and maybe even counterproductive to give elements (= everything in the <body> except scripts) a className. Just use <div style="">, <p style="">, etc.
But I would strongly recommend to use style blocks or external style sheets.
I realized that using the class didn't make sense with an inline style. Removing the class solved the problem.
The site already uses external style sheets.
Right now I'm working on a test page converting a header within a table to CSS. When I'm done it will become a server side include. In a situation where you have a SSI header, is using inline styles so horrible?
The code below shows what I'm doing to get a graphic to display acroos the screen. Is the method used ok or is there a better way?
That's quite alright. As long as you don't use the old FrontPage method, which declares styles in every tag. Also if the tag is a repetitive one, such as <p>s. Changing such a page is a horrible task. That's why I emphasized the strongly so strongly... :-)
Empty divs should be deleted, but furthermore your thought isn't that peculiar. Unless the inline style declaration consists of a number of property-value combinations. Then it will be more difficult to see errors than it is when you have them neatly arranged in a style block.
Bookmarks