jonbey — 2010-03-25T20:05:12-04:00 — #1
I use Wordpress, and I am trying to find a way to float a table (or anything) inside the content area. The table will have to come before or after the content itself, but then be positioned in a fixed place within the content.
I tried using negative margin (placing table below content) , and got it to move up, but could not get the text to wrap around (the table was on top of the text).
I tried to add a positive margin (placing table above content) but could not get the text to wrap above the table.
I looked into using indents for the table, but I failed with that.
If you are familiar with Wordpress, then I am specifically trying to get a "similar posts" list inside the content.
This is what the single.php template file looks like (part of) with the table I want within the content shown below:
<?php the_content(); ?>
<?php similar_posts(); ?>
I am aiming to get the list to appear on the left hand side, about half way down an average page. I also tried vertical align middle in the css. But if I can get it always a specific number of px that would be fine too.
I am sure it is possible. I have searched/trawled the net in the hope to find a page that does it already, and failed.
Please help me sitepoint, you are my only hope.
ryanreese — 2010-03-25T21:43:37-04:00 — #2
HI, I'm not sure what exactly your after other then how you have text wrap around a floated element.
THe answer is that you float the element (the table) but then don't float (or do anything positionining/margins wise) to the text.
jonbey — 2010-03-26T07:10:38-04:00 — #3
What I want to do is be able to have the table either before or after the content in the code, and still get it to appear in the middle, with text wrapped around. I can easily do it if the table is manually inserted mid-content, but this is on the website CMS with 1000's of pages. Need an automated solution, which will also allow me to easily change what is in the block and its styling etc.
Positioning it is the problem!
Maybe I need to do two things?
- style the content block so that it has an indent in a specific place (absolute?)
- place the block in that spot (absolute again).
I use a fixed width layout so I guess this is possible, but my CSS is not that good!
ryanreese — 2010-03-26T12:27:10-04:00 — #4
SO you need something floated in the center with text wrapping around?
Go to the top of this forum to the FAQ thread and find the float:center quiz :).