• Hi. I tried inline style sheets which I’m against, to get the two images in this post to align horizontally. Nothing has worked, including the inline style sheet with float:left on the second image to the right.

    Is there a solution that doesn’t require inline style sheets ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Just assign float: left; to both of them – via the default image alignment –

    https://codex.www.ads-software.com/Wrapping_Text_Around_Images#Image_Left.2C_Right.2C_and_Center

    Thread Starter Xfactory

    (@xfactory)

    I updated the post, with an inline style sheet;
    <img.alignright={float:right;} img src=’https://www.thecreati~~~~~
    Not floating ?

    That CSS is incorrect AND you don’t need to (and should not) use inline styles.

    Try adding this to your style.css file:

    #post-792 img {
        float: left;
    }

    BTW, where did your theme come from?

    Thread Starter Xfactory

    (@xfactory)

    The theme was custom built, why ?
    Preview the post again, the image of the content box which the post is suppose to contain within, breaks.

    Right now, you have those images in paragraph tags – which changes the CSS for them…

    The theme was custom built, why ?

    Because the built in WP alignment option should float images – if it doesn’t then your theme is missing the “required” CSS – see the link I posted above.

    If you want to try inline CSS again, this would be the correct CSS:

    style="float: left;"

    But they can’t be in separate paragraphs.

    Thread Starter Xfactory

    (@xfactory)

    Preview the post again, the inline style sheet causes the two images to overlap.

    Edit: When PHP code was developed, some parts of the theme were ignored to streamline things. I was hoping there would be a plug-in that could fill in such blanks in my theme.

    I don’t see two images on the site which makes it impossible to know what’s going on, but try adding a margin to the styles –

    margin-right: 20px;

    You’re really making things harder for yourself by using a poorly coded theme… You could try adding the required CSS as per the link above.

    Your best option is to add support for the CSS classes WordPress will add to an image embedded in a post through the Media Uploader. Take a look lines 327-341 of Underscores style.css. You should be able to add those lines to your style.css exactly and get the desired effect by aligning your images left in the Media Uploader.

    Ignoring components of a theme for streamlining ends up having the opposite effect, as you’ve discovered. It’s best to cover all the things you need your theme to do when you build it, rather than relying on plugins other people have written for basic functions your theme can and should be handling.

    Thread Starter Xfactory

    (@xfactory)

    cconover – I added the style sheets from the link from lines 327-341. Preview the post, the images are back to being aligned vertically.

    Thread Starter Xfactory

    (@xfactory)

    WPyogi – The images were overlapping, with the inline style sheet. I applied a margin-right to the image, previously. It worked but I removed it because it wasn’t aligning horizontally with the first image.

    Thread Starter Xfactory

    (@xfactory)

    Christiaan – I’m not using Media Uploader, I’m using NextGen.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Aligning two images’ is closed to new replies.