Hi to every: I'm newbiew working with Drupal and right now some people ask me for a clean page. What that's mean? Made only using CSS and XHTML valid both of them. I take a look at some tutorials in Drupal site but I'm encountered with some others problems. For example some parts, by default, have this: <h2 class="title">Something here</h2>. But I don't want really, I want something like that: <div class="title"><h2>something here/h2></div>, why? Simply: when I try to apply a padding to the class: h2.title the CSS rules logically move the entire element and I don't looking for that. I only need move the content of the element with class: title. See a little example below:
<h2 class="title">Something here</h2>
CSS rules: h2.title { line-height: 25px; padding: 0 0 0 10px; /* Move element 10px from the right to the left */ }
Now If I have this: <div class="title"><h2>something here/h2></div>
And then the some changes in my CSS rules: .title h2 { padding: 0 0 0 10px; /* Move text 10px from the right to the left */ }
This is what I'm looking for. Understand? Cheers, thanks in advance and soury for my poor English -- ReynierPM 5to Ing. Informática Maestro de poco, aprendiz de mucho
Hi, Reynier. Drupal's default theme output can be tricky at times because it's so heavy, I agree. However, all default themes and all core modules output valid XHTML Strict and CSS, by design. The example you gave, for instance, is valid XHTML Strict and CSS. "div.title h2" is a perfectly valid CSS selector.
So if someone insists that you output valid XHTML/CSS, then Drupal does that by default. (What you do in your own theme is your business, of course. <g>) If, however, they want something with fewer CSS hooks (fewer nested <div> tags, for instance), then you'll need to override theme functions to change the HTML that gets generated. See the theme developers handbook for ways to go about doing that:
90% of the time you'll only be interested in the PHPTemplate theme system, as that's what almost everyone uses. XTemplate is deprecated and shouldn't be used anymore.
Cheers.
On Friday 24 November 2006 23:26, Reynier Perez Mira wrote:
Hi to every: I'm newbiew working with Drupal and right now some people ask me for a clean page. What that's mean? Made only using CSS and XHTML valid both of them. I take a look at some tutorials in Drupal site but I'm encountered with some others problems. For example some parts, by default, have this:
<h2 class="title">Something here</h2>. But I don't want really, I want something like that: <div class="title"><h2>something here/h2></div>, why? Simply: when I try to apply a padding to the class: h2.title the CSS rules logically move the entire element and I don't looking for that. I only need move the content of the element with class: title. See a little example below:
<h2 class="title">Something here</h2>
CSS rules: h2.title { line-height: 25px; padding: 0 0 0 10px; /* Move element 10px from the right to the left */ }
Now If I have this:
<div class="title"><h2>something here/h2></div>
And then the some changes in my CSS rules: .title h2 { padding: 0 0 0 10px; /* Move text 10px from the right to the left */ }
This is what I'm looking for. Understand? Cheers, thanks in advance and soury for my poor English -- ReynierPM 5to Ing. Informática Maestro de poco, aprendiz de mucho