By bennybobw on
I'm currently working on setting up http://drupal.earthlytents.com/ and I would like to make the main content area (with the white background) have rounded corners.
I looked at this technique for setting up rounded corners, but I couldn't figure out how to fit it to this solution.
What would be the best solution for this if considering I might want to change this to an expandable layout?
This theme is based on Zen and here are my css files:
http://drupal.earthlytents.com//drupal/sites/earthlytents.com/themes/ear...
http://drupal.earthlytents.com//drupal/sites/earthlytents.com/themes/ear...
Comments
Nifty Corners
While it is different from the method you are using, you may want to look into Nifty Corners. It is a javascript solution that is widely used and reasonably well explained. Check it out at:
http://www.html.it/articoli/niftycube/index.html
I wish you luck.
Nifty Corners
Have you looked at the Nifty Corners module?
Nancy W.
proudly running 3½ sites on Drupal so far
NancyDru
alternative. Take the easy way out
I've given up trying to wedge corners into container divs that just happen to be able to be forced to pretend to have corners in the right place. That approach promises to leave your HTML unsullied, clean and semantic, but forces your CSS to insert its magic into bits of the page that don't really deserve it. Not to mention all the browser quirks to work around.
Instead I've thrown in the towel and dropped useless placeholders into the page where they are needed, and styled them instead.
I say modify your template so your #container div includes
... I usually drop them in before the close tag of that container
Then your CSS has:
Your HTML gets a tiny bit of cruft, but your CSS actually makes sense now.
Plus it seems to work as advertised in all browsers (unless you are also using borders, but that's also fixable)
The alistapart approach (emulated widely) is sorta clever, but also really ugly to debug, extend or maintain. It also often prevents you from using the page elements natural paddings and margins because of dodgy side-effects you then have to account for.
It's an alternative. YMMV
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Image Borders in Themes (PHP Template)
Hi Folks,
I'm afraid I have only an additional question, but no answers for the OP.
I am modifying a PHP Template theme (bluemarine, specifically) for my site. I want to have image borders around each node. I do not want any Javascript on my page.
I know I'll need to add a dl or table structure into the php for the node construct, but I'm not sure where or how to insert it. The node php looks as follows:
I can set the node class to have no border and no padding, then build my box inside it and around all of the php code, but I'm not sure how to build it. I'd like to have all four corners be fixed graphic images (GIF files with transparency) and I'll have a drop shadow on the bottom and right sides, for which I plan to use transparent shadows. Ideally, I wan't it to scale an arbitrary amount in any direction, so I'll have unique image files for each border, which will repeat in the appropriate direction.
Any suggestions would be appreciated. I already tried inserting a table, as below, but it failed to show up at all:
Thanks.
ooo..
You have a Zen journey ahead of you.
Tables are not the favoured way of doing things any more, but I've done what you are doing many times in the past. It's a road that must be travelled before you can throw it away and start again with pure CSS :)
<img id="upperright" src="<?= url($directory) ?>/images/center_box_LRC.gif" alt="" />Once you've sorted that out, give up, read some of the articles in http://alistapart.com/ and start again, the right way.
http://alistapart.com/articles/customcorners2
http://alistapart.com/articles/cssdrop2
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Thank you for the tips.
Thank you for the tips. I've read several similar articles and the drop shadows in particular are better done in the way your article describes.
The corners and borders though... All of the dt implementations I've seen use finite sized left corner/top image that will break if the page is sized such that the box in question is wider than the image. Also, I want scaling borders on the left and right to allow for arbitrary box height. Both of those work with table cells, but not with dt, to the best of my knowledge.
My final goal is a node of arbitrary size with rounded corners, a colored pinstripe just inside the edge, and a transparent drop shadow that can go over any background. Tables can do all this, but I'm beginning to doubt CSS can, at least w/o a slow javascript hack. The more I research, the more zen I need to become. ;^)
good luck
I'm guessing you mean DIVs when you say DT...
It's harder to do all four corners at once with them, yes, but possible.
Some examples give you heaps of wrappers (yuck), But on a bored afternoon I got what I wanted with truly minimal markup.
Being able to do that was so much nicer (although more of a headache) than the old tables way. Compare the source on those two!
You see, it's only AFTER doing those methods that I decided to just use positioned placeholder spans for most corner jobs. I haven't yet done an example that stretches both up and across like that, but there will be a way...
Anyway, if you think the finite image sizes are a problem ... make them bigger than you'll ever need! Extra areas of solid colour are free in gifs - this includes horizontal gradients.
... and my tip above was supposed to read
<img id="upperright" src="<?= url($directory) ?>/images/center_box_LRC.gif" alt="" />
but I stuck 'code' around it on preview...
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Thanks a bunch, dman. This
Thanks a bunch, dman. This is all very helpful to me. I'll keep looking for a css way to do what my tables do, as I'm something of a perfectionist and the table method has always felt kludgey, just less so than using finite, non-repeating graphic images for something that is theoretically infinitely scalable.
I love that FD box, BTW. Very elegant. Perhaps I'll ditch my hangup over large bg images that aren't infinitely scalable and go that route. Very clean. It looks like you only did 3 corners on this one, though. I'd guess you just need a dedicated, non-scalable right corner image and an extra div to get that effect, I'll experiment.
I feel very stupid that I neglected the difference in file location for the PHP file vs. the css file. Thanks for pointing that out. However, for some reason, the <?= url($directory) ?> insert didn't work. I had to code the path directly. Any thoughts on why? Is the $directory variable specific to some theme engine?
Actually, when I said dt, I meant to say DL, for Definition List., but it's little different from using more divs.
One more neophyte question. For some reason, the background images do not show in the top/bottom/side border cells. These are defined in the css file in the class for each cell, and seem to be defined correctly, but they simply don't render. I can't cerrently gte to the css source, but I'll post it later in case anyone can see my error.
Is putting the table structure INSIDE the Node DIV wrapper the correct way to go, at least until I see the error of my ways and give up tables forever?
fun,
Yes, you caught that I only did 3 corners :). I got that far and decided I could get away with it - for that image. So maybe not a perfect general-case solution, and yeah, an 10x10 top right positioned placeholder would do the job if I needed.
I used almost the same markup for a Drupal theme (still slightly unpolished) on a dev site.
http://www.coders.co.nz/drupal_development/
... where I was seeing how well I could do with just CSS and no template modifications from the Drupal theme default. (that's based on css_simple.theme, which is a package of 30 alternative CSS extensions to one .theme .tpl.php set)
According to the docs, available theme variables $directory should just work, and is of course better than hard-coding stuff (Although I did the same for a few rounds until I found the right way - eventually learning by example). Once you've moved all your image styles into the css, the problem goes away again. CSS url() paths are relative to the CSS file itself ... at least in compliant browsers - there was some confusion about that once.
Useful tip: Check your 404 logs and you'll see where the background images are being looked for - according to your browser - and you'll be able to correct accordingly.
The <?= ?> shorthand (inheirited from one persons theme/code style) may not be working for you, depending on php.ini. The clearer way is to just
print $directoryI guess.Where you put your table is up to you. There's no clear call on where in the DOM the labels really fit. You may not need the node div wrapper at all if you migrate those attributes into the table itself.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
OK, almost there, hacking
OK, almost there, hacking from dman's code. Translating it into the bluemarine variant theme I'm working on will be easy, once this last problem is resolved.
Sample at: http://www.ternea.com/working/sample_node_borders.html
Now I just need to figure out how to end my background x number of pixels before the end of a div, so I don't get overlap from my backgrounds at the corners. Any suggestions would be greatly appreciated.
try...
That was broken in both IE6 and FF for me.
Don't trust floats for this. Position absolute.
This worked:
As for stopping short, either play with negative margins (YMMV), or give up on that full transparancy. Fill in those gifs.
One possible negative margins version. works in FF, not well in IE.
Not recommended as if plays hell with other wrapper calculations.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
> As for stopping short,
> As for stopping short, either play with negative margins (YMMV), or give up on that full transparancy. Fill in those gifs.
Thank you. Unfortunately, the background is a texture, so transparent gifs or pngs are a must. On the positive side, my audience is limited and I do not have to support down rev browsers of any stripe. Currently, it's looking like inserting a table inside the node wrapper div and around the content, with transparent gifs for the border, is the only method that supports everything I need and works in IE6-7, Mozilla 1.0-1.7, Firefox 1.0-2.X, Opera, and Safari. If I don't care about IE6, I can go with pngs and the shadows will look better.
I have one more CSS structure to try, but it seems odd that such a commonly performed task is much easier and more browser compliant than any of the CSS box models I've tried.
Search is Your Friend
Styling rounded corners for blocks
You don't need JS as a work-around - Drupal has too much as it is... IMO.
HTH
Mike
------------------------------------------------------------------------------------------
A simple thanks to those that help, a price worth paying for future wealth.