By smallbizpod on
Hi
Just wanted to say what a fantastic resource this is. I'm experimenting with Drupal for a site I'm building and have learned masses without just be searching, but I'm stuck ...
I'm trying to create rounded corners for blocks. I've successfully managed to achieve rounded corners at the top of a block by styling the .title element and also have nice shadow edges for the block by styling the background of the block itself, but ...
I can't seem to find any tag to fix the rounded corners at the bottom of the block.
Any ideas how I might be able to achieve this?
Cheers
AB
Comments
I think this is the way to do it
I'm gonna respond with what I do, but I am new to Drupal, so I am still curious if this is the best considered practice.
You can customize the HTML for all blocks in your template folder in the block.tpl.php file. Here you can probably add a or
To do it without changing the theme - you might be able to add a background image for the bottom of ".block .content" ?
Have fun! and let me know what works.
Try this
Not tested for blocks but should work.
Clearly, you'll need to have the round corner images made and you'll need to change the names and path to them in the code below.
In your block.tpl.php file:
CSS:
Mike
Fantastic - many thanks
Brilliant, I'm off to try these suggestions out ... really very many thanks.
In the interim in css I had managed to attach the bottom rounded corners to the block .content tag, but need to sort out a few things to make it look pretty.
Many thanks for the block.tpl example - I'll let you know if it works!
Thanks
AB
block.tpl works a treat
Mike, the block.tpl method works a treat, although I had to tweak a little for my theme obviously.
I've also sussed out that I can use this method to theme blocks using different styles depending on their location. I've used conditional statements based on the 'regions' variable within block.tpl to call additional customised block.tpls files. This means my blocks are automatically styled how I want them depending on their whereabouts on the site.
Probably very obvious to others ... but a bit of a light-bulb moment for me, bearing in mind my novice status with both drupal and php.
Thanks again.
AB
Good stuff - Glad it worked
Good stuff - Glad it worked for you.
Mike
Great! and... Borders?
This worked like a charm. Thank you!
My one problem is that I can't add a border without it showing up as a box around the area. I want to have rounded blocks with evenly rounded borders.
Any thoughts?
-samantha
--
www.digitalaid.net
...and for rounded corners with different backgrounds...
...a simple idea: if you need to change block background color (i.e. if you have blocks with different backgrounds), without saving again 4 new corner images, you can create those images using transparent gifs.
Imagine you have a black body background and a grey block background.
As usual, you create an image with black background, and then draw a rounded corner area, filled with grey.
Then you save that as a .gif, and make the grey area transparent. The resulting image will be only such a semi-lunar black area. It will cover any background color you choose with a perfect rounded corner.
Pay attention in applying transparence: zoom in and make all non-black pixels transparent.
Look at Roundness
Have a look at the roundness theme. Maybe you could use something from there.
This looked very promising but...
...for the fact that it uses tables for the layout. Will have to try some of the other suggestions above instead.
tables are out ...
tables are out use tableless CSS =)
www.evolvedideas.net
Evolving Ideas for the methods of marketing for internet entrepreneurs.
How can I have rounded
How can I have rounded corners for right side bar blocks only?
I always just put the divs
I always just put the divs in the header and footer of the block, that way I can easily pick which block gets it and which one doesn't and I can even stick 2 blocks together without ppl even noticing that they're 1 element with a 2-sided rounded bar in the middle :p
Yeah, you just need to
Yeah, you just need to qualify the CSS selector with the region or view (which creates a CSS ID selector), like this example:
block.tpl.php:
css snippet:
Tip of the hat to Andy Budd CSS Mastery: Advanced Web Standards Solutions p. 48 "Fixed Width Rounded Corner Box".