Forums

Adding CSS to <?php the_content('more...'); ?> (7 posts)

  1. btlewand
    Member
    Posted 6 years ago #

    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.

  2. Samuel B
    moderator
    Posted 6 years ago #

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

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

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

    Try using a span instead.

  4. btlewand
    Member
    Posted 6 years ago #

    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.

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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>'); ?>

  6. btlewand
    Member
    Posted 6 years ago #

    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?

  7. btlewand
    Member
    Posted 6 years ago #

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

    Thanks everyone.

Topic Closed

This topic has been closed to new replies.

About this Topic