Support » Themes and Templates » Can I put “clear:both;” in the stylesheet somehow?

  • Resolved wordsnyc

    (@wordsnyc)


    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Cool — that works. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can I put “clear:both;” in the stylesheet somehow?’ is closed to new replies.