/    Sign up×
Community /Pin to ProfileBookmark

[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: [URL=”http://linksku.com/forum”]http://linksku.com/forum[/URL]

I tried:

[code=html]div#page div#page-content {
margin: 0 0 0 6px;
padding: 5px;
}[/code]

[code=html]#page-content {
margin: 0 0 0 6px;
padding: 5px;
}[/code]

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@tirnaJun 29.2010 — 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
}
[/CODE]


and if you haven't already done so, validate your css at the

w3c css validator.
Copy linkTweet thisAlerts:
@narutodude000authorJun 29.2010 — 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.
Copy linkTweet thisAlerts:
@Declan1991Jun 29.2010 — 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.
Copy linkTweet thisAlerts:
@Major_PayneJul 01.2010 — Using [CODE]div#page div#page-content {
margin: 0 0 0 6px;
padding: 5px;
}[/CODE]


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 -->[/CODE]


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;
}[/CODE]


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.
×

Success!

Help @narutodude000 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...