www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] Why doesn't this work?!?!?

  1. #1
    Join Date
    Mar 2010
    Posts
    701

    resolved [RESOLVED] Why doesn't this work?!?!?

    I'm trying to add styles for a div. For some reasons, the div doesn't change.
    I tried many different methods, but it still doesn't work. The page is here: http://linksku.com/forum

    I tried:
    HTML Code:
    div#page div#page-content {
    	margin: 0 0 0 6px;
    	padding: 5px;
    }
    HTML Code:
    #page-content {
    	margin: 0 0 0 6px;
    	padding: 5px;
    }

  2. #2
    Join Date
    Mar 2010
    Posts
    2,803
    I don't normally click posted links for obvious security reasons and sometimes people just post links to advertise their websites, but anyway, without seeing your code maybe try

    Code:
     
    #page-content {
    margin: 0px 0px 0px 6px;
    padding: 5px, 5px 5px 5px
    }
    and if you haven't already done so, validate your css at the
    w3c css validator.

  3. #3
    Join Date
    Mar 2010
    Posts
    701
    I got 90 errors and 3616 warnings! I'm using Wordpress, so I'm guessing there shouldn't be mistakes.

    That doesn't work. The CSS isn't even reaching the div. When I use google chome's inspect element feature, the CSS style isn't even in the "style attributes" section.

  4. #4
    Join Date
    Aug 2007
    Posts
    3,767
    Firstly div#page div#page-content that is a waste of time, just use your second option because ids have to be unique anyway, and all those selectors literally are a waste of time.

    You cannot have multiple ids on an element or the page. Ids have to be unique, and each element can only have one. Classes do not have to be unique, and multiple classes can be on a page.

    Remove all multiple ids and use classes if necessary instead.
    Great wit and madness are near allied, and fine a line their bounds divide.

  5. #5
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,214
    Using
    Code:
    div#page div#page-content {
    	margin: 0 0 0 6px;
    	padding: 5px;
    }
    The HTML would have to be something like this:

    Code:
    <div id="page"><!-- START Page Style -->
    <div id="page-contents">
    <p>Page Contents here.</p>
    </div>
    </div><!-- END Page Style -->
    That would ONLY apply the CSS to id="page-conts div. If you want BOTH divs styled that way, then add a comma:

    Code:
    div#page, div#page-content {
    	margin: 0 0 0 6px;
    	padding: 5px;
    }
    BTW, zero is dimensionless so no dimension name needs to be set. Personally, I think you may have more divs than you need.

    WordPress isn't perfect, but you can control some of those erros by setting your CSS and HTML pages properly when editing. Don't use WordPress so not sure if you can edit the PHP files themselves, but I think all they do is generate the HTML according to the way you coded it and the CSS. If you make mistakes, then that's the way the pages are generated for the browser.
    Last edited by Major Payne; 06-30-2010 at 09:32 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles