Floating an image on the right
philwild - October 20, 2009 - 17:03
| Project: | ImageField |
| Version: | 6.x-3.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hello,
I am experimenting with CCK and imagefield and trying to understand how things work. I have an imagefield associated with the page content type and I would like it to appear on the right of the page with the text wapping around it (float: right). By default, cck seems to include the image inside the DIV that the node body is in so I can not theme it using a style sheet (or at least I don't have the knowledge to figure out how to do this). I have started playing with contemplate buthave run into issues with that module too.
What is the best way of doing this?
Many thanks
Phil

#1
#2
You should edit the style.css file in your theme and add a
float: rightto the wrapping div around the image.#3
Thanks but that is what i am trying to do. However, when I look at the source, this is an extract of what I see... The image is enclosed in the same div as the content of the node body so I can't get the text to wrap around it.
Many thanks for looking...
Phil
<div class="node-inner-0"><div class="node-inner-1">
<div class="node-inner-2">
<div class="node-inner-3">
<h2 class="title"> title </h2>
<div class="content clearfix">
<p>node content in here from the body field of the node</p>
<div class="field field-type-filefield field-field-image">
<div class="field-items">
<div class="field-item odd">
<a..... image in here>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
#4
Yeah...
It's within the content, but in a well-labelled element of its own, so
.field-field-image {float:right;
}
or similar would be a start.
Of course, because of the layout and CSS, you may have to shift the field up a little bit, so it comes before the body content in the document flow.
#5
I have exactly this in my style.css and it does not work because the actual content is not in a separate div
I toyed with the idea of moving the cck field above the body field in the create content form but felt this would be counter intuitive to someone adding content (I am doing this for a school and am expecting the teachers to upload content). It would be nice f you could re-order the output of the fields though...
I have also thought about removing the body field altogether from the node and replacing it with a cck text field so that I have more control but felt that this was stepping a little outside of the box... It also raises the issue of splitting teaser wording out from a full page...
I have been digging through the code for my theme and this is in node.tpl.php
<div class="content clearfix"><?php print $content; ?>
</div>
I have been trying to figure out if there is a way of getting into $content and wrapping a div around the body data before the cck data is appended but this is starting to go above my level of expertise...
Cheers
Phil