SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist jonbey's Avatar
    Join Date
    May 2007
    Posts
    507
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Want to position/float a block/table inside a content section in Wordpress

    Hello

    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 Code:

    <?php the_content(); ?>
                     
    <TABLE class="inside">
    <TR><TD>    
    <?php similar_posts(); ?>
    </TD></TR>
    </TABLE>
    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.

  2. #2
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,567
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    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.
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work

  3. #3
    SitePoint Evangelist jonbey's Avatar
    Join Date
    May 2007
    Posts
    507
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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?

    1. style the content block so that it has an indent in a specific place (absolute?)
    2. 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!

  4. #4
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,567
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    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 .
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •