WordPress.org

Ready to get started?Download WordPress

Forums

adding HTML & CSS style to a post (4 posts)

  1. mfacer
    Member
    Posted 8 years ago #

    I've switched off the WYSIWYG editor - and am trying to put in some style for a post. eg:

    <style type="text/javascript>
    .matt { color: #FFFFFF; }
    </style>
    <p class="matt">Hello

    it appears in the editor ok - but when it is viewed as a post on the website, the code has been put with <br /> tags around it! It looks like this:

    <style type="text/javascript">
    .matt { color: #FFFFFF; }
    </style>
    <p class="matt">Hello

    that then means the stlye is not working!!
    where can I change the code to stop it doing this - or is there some function I can use to ignore ANY html in a post (ie: It isnt altered)...?

  2. Cypher
    Member
    Posted 8 years ago #

    For starters, you have the wrong "type" for CSS markup. It needs to be 'type="text/css">'.

    You may want to go to your admin panel, Options->Writing and uncheck "WordPress should correct invalidly nested XHTML automatically" if it is set.

    Try again and see what happens.

    Short of that, you may want to add any POST specific styles that you normally use in your "style.css" file for your theme..

    Regards

  3. mfacer
    Member
    Posted 8 years ago #

    hi cypher...

    thanks for the reply.. the XHTML box was not ticked, so that's not made any difference.

    It's not essential, its just that I use my blog as examples, and I wanted to show certain mouse over techniques using CSS and i cannot do it !! It's a pitty you cant maybe build a tag to tell wordpress to take the text literally, and not to be clever and replace \n with <br />.

  4. Nazgul
    Member
    Posted 8 years ago #

    I've made a small plugin that 'fixes' this behavior. More info.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags