WordPress.org

Ready to get started?Download WordPress

Forums

Image float (2 posts)

  1. draghnfly1
    Member
    Posted 5 years ago #

    Can anyone help a CSS novice? My style sheet has this code:

    float: left;
    	border: none;
    	margin-right: 15px;
    	margin-bottom: 10px;

    I understand how this works but how can I override it to position my pics inline or floated right without changing the default? Thanks for any help.

  2. stvwlf
    Member
    Posted 5 years ago #

    hi

    if these don't already exist in your theme's stylesheet, create

    .alignleft {
    float: left;
    border: none;
    margin-right: 15px;
    margin-bottom: 10px;
    }
    .alignright {
    float: right;
    border: none;
    margin-left: 15px;
    margin-bottom: 10px;
    }
    To make it float right,
    In the post editor, edit your post and go into the HTML tab. For the post you want to float right, find the <img tag

    add this
    <img class="alignright" src="... "

    If it already has a class for alignleft or something similar, remove that and leave the alignright. That will float it right.

    If you want to center it, an easy way is wrap it in a div
    <div align="center"><img ... /></div>

Topic Closed

This topic has been closed to new replies.

About this Topic