WordPress.org

Support

Inline styles

  • How do I make word press NOT remove my inline styles every time I save?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Don’t use inline styles. Every style should be in the style.css.

    In extreme cases… turn OFF the idiotic wysiwyg (visual) editor. Do NOT switch between visual/code – it is useless. Turn it off, if you know code, you don’t need it.

    Actually, I think that there are times when inline styles are extremely helpful, especially when you don’t want to have to create yet another class for just one page which may even change later.

    I found this to be an annoyance too unfortunately.

    I too am struggling with a particular bit of code. I can get the CSS to work using inline styling (in this case, <div style=”float:left;padding-top:10px;”>). However, when I try and put those 2 styles into a class or ID for a div class or id…the content inside that div just wont render.

    Code seen here:

    <div style="padding-top:10%;float: left;" ><object
    	data="<?php echo get_bloginfo('template_directory'); ?>/images/PrivThaiTours.swf"
    	type="application/x-shockwave-flash"
    	width="200"
    	height="62">
    	<param
    		name="movie"
    		value="<?php echo get_bloginfo('template_directory'); ?>/images/PrivThaiTours.swf">
    </object></div>

    Styling (css)

    #advert {
    padding-top: 100px;
    float:left;
    }

    or in the case if a class is necessary for that div:

    .advert {
    padding-top: 100px;
    float:left;
    }

    What would cause an inline style method to work for this and not for when I try and do the “right thing” by putting it in style.css?

    Because of the the “cascading” nature, inline styles have the highest precedence over the style defined in the stylesheet.

    However, the assigned styling is many times over-ruled by the browsers.

    You can ensure that there is no conflicting inline style when an element is styled by the a stylesheet.

    S.K

    Kichu>

    Thats what Im takling about. I would love to have it in the CSS sheet rather than inline. However when I remove the inline styling and change the div to have a class rather than “style”, adding that padding information as a class in the style.css…. I find that the image inside that div goes away completely.

    //I find that the image inside that div goes away completely.//

    Could you post the URL with such behaviour?

    S.K

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Inline styles’ is closed to new replies.
Skip to toolbar