WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can I put "clear:both;" in the stylesheet somehow? (5 posts)

  1. wordsnyc
    Member
    Posted 6 years ago #

    Hi, in the theme I'm using I want to prevent text from wrapping around images in posts. At present I put "<div style="clear:both;"></div>" in the code of the individual post, but if I edit the post after it's saved that code disappears and has to be re-entered.

    Is there a way to add "clear:both" to the image parameters in the stylesheet so it automatically applies to all images?

    Site is here.

  2. tshirtfiend
    Member
    Posted 6 years ago #

    Try adding this line to your css:

    .post img {
    display:block;
    }

    Images default to displaying inline (as opposed to displaying at block level, like divs and paragraphs).

    You could do something like:

    .post img {
    clear:both;
    }

    …but it's kind of overkill. Plus, you have some other floats going on, so it might mess w/ things. Give it a shot though, if the other doesn't work.

  3. wordsnyc
    Member
    Posted 6 years ago #

    Unfortunately, neither seems to work.

    BTW, this:

    body {
    	background:#FFFFFF;
    	font:80%/1.5em Arial, Helvetica, sans-serif;
    	color:#333333;
    	margin:0;
    	}
    img {
    	vertical-align:middle;
    	border:none;
    	}

    is the only mention of img in the original stylesheet, if that matters.

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

    The display:block thing will work, however you cannot put "align" on any of your images. If you align them left or right, then that triggers the wrapping as well.

  5. wordsnyc
    Member
    Posted 6 years ago #

    Cool -- that works. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags