Jump to content

Proper Css Method


Recommended Posts

So general layout question here... which method is proper styling? obviously this is a dumbed down example of all the elements and stuff Ill be working with but just curious if it was better to list 1 style multiple times or 1 class or ident or whatever multiple times. I wanna be as professional as I can be in my writing so Im trying to learn proper techniques now #example1 {color: red;height: 43px;border: 1px solid black;} #example2 {color: red;height: 10px;border: 1px solid green;} #example3 {color: red;height: 100px;border: 1px solid purple;} OR#example1, #example2, #example3 {color: red;} #example1 {height: 43px;border: 1px solid black;} #example2 {height: 10px;border: 1px solid green;} #example3 {height: 100px;border: 1px solid purple;}

Link to post
Share on other sites

There is no defined better practise for this case.If it's just for one property, I wouldn't bother using the multiple selectors, but you can save a lot of code if you have many elements with the same kind of style.

Link to post
Share on other sites

another question for ya... the rounded borders for instance... I think its firefox that uses a border command that works well but is not 'validated' how proper is it to bypass that via javascript or is there a better less... shady way to work around that problem.

Edited by lchosts
Link to post
Share on other sites
You don't need to worry about having valid CSS.
That's nearly impossible anyway if you want to use things like gradients, rounded corners, opacity, and any other number of new/proprietary properties. Any of the -moz, -webkit, -o or -ms properties will be invalid. All proprietary properties, like filter in IE, will be invalid. So, long story short, don't worry about your CSS. If it all works together like it's supposed to then you're good to go.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...