As I am getting the hang of CSS, a question came to mind. In HTML, it seems there really is one way to write something in order to get the proper result (I mean, there may be several ways to get a desired result, but the structure of the code has to be correct for it to be valid). In CSS, since I am really just beginning to learn, it seems that some of this structure goes out the window. There may be several ways to get a desired result, and several authors may write different style sheets, but all basically create the same thing. As I look at CSS examples, it seems there is no simple way to look at my own CSS and say this is not right (aside from glaring mistakes). Am I thinking on the right track? My style sheet validates, no errors are returned, but would someone more experienced look at my style sheet and say, "This is really not the proper way to write this."? (I don't even know if my question makes sense...I will find out from the responses I get.) Thanks for reading. Can you post a link to your css?CSS is a bit like JavaScript in this manner. It's an assistive technology, so the page will (or at least should) work completely fine without it. In the event that the technology is available, though, it should indeed be written correctly. Validating your CSS is the primary step. There is no particularly correct structure in CSS, but for the most part, if it's valid, you're likely to be writing it correctly. (I keep saying "if it's valid" because in the same way that certain IE-proprietary JavaScripts are used, for example the innerHTML property, you shouldn't use IE-proprietary CSS styles, for example glowing text.)
Other than that, test it in multiple browsers, and if it doesn't work in one, read up on some hacks to make it do so. If your HTML is structured properly, it almost forces you to write good CSS. Just make sure you add enough whitespace so that your code can be read easily.It's probably a lot like writing software programs. For any given function you write in a program, there are "elegant" solutions that are clear, concise, and efficient; there are terse solutions that use a minimum of code, though that does not necessarily mean they are the fastest (or best) solution; there are long solutions built up of many simple, individual steps that are easy to understand but far from being elegant; and there is "spaghetti code": it works, but nobody can figure out why because it's such a tangled mess (and it's a nightmare to try to maintain). Then, even within the "elegant" solutions, you will get arguments among the software engineers as to which are more correct: some may use aspects of the programming language in a manner they weren't intended to be used, some will claim one method is more efficient than another, etc.
I suspect CSS can be the same: there can be several solutions which can all work. The job of the web page developer should be to select the solution which is not needlessly complex and which is as maintainable as possible (i.e: when you look at it a year later you won't have to spend hours trying to figure out what you were thinking a year ago ).A link to my style sheet...(it seems very long and complex, but since it really is my first foray I am thinking maybe long is normal. Complex, well, maybe that is just me being new to this)
See the CSS (<!-- m --><a class="postlink" href="http://home.earthlink.net/~aimeelmarshall/style.css">http://home.earthlink.net/~aimeelmarshall/style.css</a><!-- m -->)I recommend two books.
Why? designing with web standards (<!-- m --><a class="postlink" href="http://www.zeldman.com/dwws/">http://www.zeldman.com/dwws/</a><!-- m -->)
How? Web Standards Solutions (<!-- m --><a class="postlink" href="http://www.simplebits.com/publications/solutions/">http://www.simplebits.com/publications/solutions/</a><!-- m -->)
Generally speaking your css looks fine. As you go along you'll learn the "cascading" aspects of it and that will simplify your styles in that you'll learn to eliminate the redundancies.
Other than that, test it in multiple browsers, and if it doesn't work in one, read up on some hacks to make it do so. If your HTML is structured properly, it almost forces you to write good CSS. Just make sure you add enough whitespace so that your code can be read easily.It's probably a lot like writing software programs. For any given function you write in a program, there are "elegant" solutions that are clear, concise, and efficient; there are terse solutions that use a minimum of code, though that does not necessarily mean they are the fastest (or best) solution; there are long solutions built up of many simple, individual steps that are easy to understand but far from being elegant; and there is "spaghetti code": it works, but nobody can figure out why because it's such a tangled mess (and it's a nightmare to try to maintain). Then, even within the "elegant" solutions, you will get arguments among the software engineers as to which are more correct: some may use aspects of the programming language in a manner they weren't intended to be used, some will claim one method is more efficient than another, etc.
I suspect CSS can be the same: there can be several solutions which can all work. The job of the web page developer should be to select the solution which is not needlessly complex and which is as maintainable as possible (i.e: when you look at it a year later you won't have to spend hours trying to figure out what you were thinking a year ago ).A link to my style sheet...(it seems very long and complex, but since it really is my first foray I am thinking maybe long is normal. Complex, well, maybe that is just me being new to this)
See the CSS (<!-- m --><a class="postlink" href="http://home.earthlink.net/~aimeelmarshall/style.css">http://home.earthlink.net/~aimeelmarshall/style.css</a><!-- m -->)I recommend two books.
Why? designing with web standards (<!-- m --><a class="postlink" href="http://www.zeldman.com/dwws/">http://www.zeldman.com/dwws/</a><!-- m -->)
How? Web Standards Solutions (<!-- m --><a class="postlink" href="http://www.simplebits.com/publications/solutions/">http://www.simplebits.com/publications/solutions/</a><!-- m -->)
Generally speaking your css looks fine. As you go along you'll learn the "cascading" aspects of it and that will simplify your styles in that you'll learn to eliminate the redundancies.