WordPress.org

Ready to get started?Download WordPress

Forums

Inline styles (7 posts)

  1. MrB398
    Member
    Posted 5 years ago #

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

  2. moshu
    Member
    Posted 5 years ago #

    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.

  3. thelaw
    Member
    Posted 5 years ago #

    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.

  4. WebmistressM
    Member
    Posted 4 years ago #

    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?

  5. S.K
    Member
    Posted 4 years ago #

    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

  6. WebmistressM
    Member
    Posted 4 years ago #

    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.

  7. S.K
    Member
    Posted 4 years ago #

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

    Could you post the URL with such behaviour?

    S.K

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.