Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Background color under text only

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #153829
    gabbagabba
    Participant

    I am trying to get a background color that follows the text only and not the width of the div or whatever.

    I am using wordpress. I set up a span in the content.php, and removed the p’s from pages. Then it works and the code is something like:

    <div class="entry-content">
    <span>
    my text...
    </span>
    </div>
    

    But I need the p’s in pages… And if the code is like this it doesn’t work..:

    <div class="entry-content">
    <span>
    <p>
    my text...
    </p>
    </span>
    </div>
    

    Is it only with span I can do this?

    Would appreciate any help or advice.

    #153830
    Paulie_D
    Member

    I don’t think

    <span><p> </p><span>
    

    is valid HTML…and having all your text wrapped in just spans will give additional issues due to their block level formatting differences.

    <p><span> </span><p>
    

    Would be better…if you must. : http://codepen.io/anon/pen/yJuBi

    #153831
    gabbagabba
    Participant

    If I set up that in the content.php, it will be

    <p><span><p></p></span></p>
    

    Cause WordPress auto puts the <p> in the pages. And I need the <p> to get line shifts…

    #153832
    gabbagabba
    Participant

    Or I will have to manually insert a <span></span> for each paragraph in Pages (WordPress)…
    That sounds like a hard way to do it for me..

    #153835
    Paulie_D
    Member

    Cause WordPress auto puts the <p> in the pages.

    You can remove the automatic <p> tags with a setting/plug-in if that is the primary issue.

    Moving to PHP/WP issues as that would seem to be the issue rather than CSS.

    #153856
    gabbagabba
    Participant

    I have already done this in the functions.php:
    remove_filter( 'the_content', 'wpautop' );

    But that removes the line shifts in my Pages content.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.