• btlewand

    (@btlewand)


    I have created a post that is a table with two columns. The left column of the table contains a graphic, the right of the table contains text. The text has a div class wrapped around it in the home.php file in order to float left the content to the left border of the second column.

    Everything works beautifully but for some reason the ‘more…’ floats left all the way to the first column’s left border when all all the content only floats to the left border of the second column as it’s supposed to.

    I have tried changing:

    <?php the_content(‘more…’); ?>

    to:

    <?php the_content(‘<div class=”right”>more…</div>’); ?>

    with the <div class> having float right and right margin properties to get it to align with the left border of the second column. This works but I get an XHTML Validation error saying I cannot put a <div> in that location.

    Anyway to format the <!–more–> tag using CSS? Also tried doing it with a <div> within the post, but the code in the home.php file overrides it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Samuel B

    (@samboll)

    You might want to look at this:
    http://guff.szub.net/2005/02/26/the-excerpt-reloaded/
    example styling at end of post.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    This works but I get an XHTML Validation error saying I cannot put a <div> in that location.

    Try using a span instead.

    Thread Starter btlewand

    (@btlewand)

    I’ll give the plug-in a try.

    I’ll also relook at the span option but it seemed like I tried that already and even got more xhtml errors than if I used “id” or “class.”

    Thanks so much for the suggestions and quick responses.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I’ll also relook at the span option but it seemed like I tried that already and even got more xhtml errors than if I used “id” or “class.”

    No, I meant try using a SPAN instead of a DIV. Both SPANs and DIVs are used for marking chunks of stuff, except a DIV is a block level element where a SPAN is an inline element. If you can’t place a DIV there, that’s probably because it’s a block element. Use a SPAN with a class instead:

    <?php the_content('<span class="right">more...</span>'); ?>

    Thread Starter btlewand

    (@btlewand)

    OK, the <span class> takes care of the XHTML issues and looks fine in IE6 but in Firefox the “more…” link is now pushed down against the beginning of the post’s postmeta section. I’ll probably need to experiment with some additional CSS in the <span class> to see if I can get the spacing to work better.

    You are on a roll, any thoughts?

    Thread Starter btlewand

    (@btlewand)

    Solved. Added 20px to the postmeta top margin and it fixed the Firefox issue without impacting IE.

    Thanks everyone.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding CSS to <?php the_content(‘more…’); ?>’ is closed to new replies.