Hi. My drupal css seems to be acting strange. In normal websites I've made before, the css is fine. But now that I've implemented drupal, my css is acting weird. Is there some special piece of code I need to include in my page.tpl.php or style.css code to that things start shaping up? I've coded everything from scratch and have the
<?php
print $styles
?>






I think I should clarify.
I think I should clarify. When I use padding, instead of adding internal padding to the inside of my divs, it instead, moves the outside of my divs and repositions them on the page. This is really frustrating.
I have a div centered by doing the following:
#content_body {
margin-left: auto;
margin-right: auto;
padding: 10px;
}
I want the div centered with padding inside of 10 pixels. But instead it's using that padding to off center the entire div. It's like it's interpreting padding as margins as well. I dont get it! This has never happend to me when coding a regular site.
.CSS Woes
Hey Anonymous,
Welcome to Drupal.
Drupal will automatically recognize style.css when placed in your theme folder. Additional style sheets can be added via drupal_add_css(). However, it sounds like your .css is being recognized; it's just acting a little wonky.
Browsers will mess with your .css; Druapl won't. However, Drupal, based on your configuration, will be calling any number of style sheets. What is most likely happening is that one of these additional style sheets is affecting the div you're trying to style. Firebug will help Firefox tease out just where all your styles are coming from.
Try renaming your ID:
body {margin-left: auto;
margin-right: auto;
padding: 10px;
}
Alternatively, as a quick check, add:
* {margin: 0px;
padding: 0px;
}
at the top of your style.css. This will zero out the inherited margins and padding and help isolate just what's going on.
Blessings!
-NP