39 users online (0 members and 39 guests)  

Thread: Repeated CSS


  Results 1 to 3 of 3
  1. #1
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Question Repeated CSS

    I find in a lot of the CSS that I pilfer from around the place, that it is very common to repeat tags within the style sheet.
    Is there a reason for this, or is it just mistakes on the part of the writers?
    For example:
    Code:
    	form {
    		float: right;
    	}
    	form fieldset {
    		width:auto;
    		display:block;
    		float: left;
    		padding:0 5px 5px 5px;
    		font-family:verdana, sans-serif;
    		line-height:1.5em;
    		border:1px solid #fff;
    	}
    	form fieldset {
    		margin: 0;
    		padding: 0 4px 4px 0;
    		border: 1px dotted #eee;
    		font-size:.75em;
    		color:#555;
    		font-style:italic;
    		margin:0 0 0 5px;
    	}
    	form fieldset:hover {
    		border: 1px solid #ccc;
    	}
    The "form fieldset {" occurs twice - is that for a reason, or can all the styling be combined in the same { ... } set?
    In the second fieldset style, we have "margin: 0;" and "margin: 0 0 0 5px;" - is there a reason for this (does the margin: 0; 'reset' any previous settings?) or is it just bad code?

    The main reason I ask is that these styles have come from well-respected stylists, and they work very well, so I'm reluctant to change them without some more knowledge.

  2. #2
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Repeated CSS

    Just sloppy code (raises hand...guilty)
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  3. #3
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: Repeated CSS

    Cheers Dave ...
    If I remove it and it breaks - I'll be after you



Tags for this Thread