• Hey guys!

    I’m putting up an easy portfolio web page with a theme that I like. I know that is not the right thing to do but I customize it with the CSS editor.

    Now I have formed it to a way that I prefer and I just realised that the theme have a block on like 60rem aligned to the left. The only way to post things bigger then that is to put the media to the full width preference, which some times looks good ofc, but I want the flexibility and opportunity to have the size in the way that I want.

    So my question is, how do I fix this in the best way? I have tried to delete the block and modified it, with no good result. I doesn’t want it to affect the text and other objects on the page. Just the images and the video files.

    Also, if I choose the big size option in WordPress the image have margin on the left but gets really big and no margin on the right and a slider appears horizontally just to be able to slide right for the whole image.

    Anyone have any suggestions?

    Thanks on behalf
    D

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    With block elements, it’s easier to target only image or video elements because they have their own blocks with specific classes. I’m assuming you are really using the block editor and not merely editing in the “classic” block.

    You can exceed the post container margins by styling the element to position: relative; and setting the left rule to some negative distance. For example:

    .wp-block-image {
      position: relative;
      left: -10rem;
    }

    Of course you will need media queries to properly manage appearance on small screens which have little or no margins to exceed.

    Ideally, you should add an image size that is ideal for your post width so the browser is not forced to use a bigger image than necessary. Regardless, if you style an image’s container (not the img tag, but a figure or div that contains it) to a specific width, then specify the img tag within has a width of 100% (of its container), and assuming the container itself does not overflow, then you can avoid getting scroll bars on images.

    Using the CSS editor is discouraged in part because any changes you make could be lost when your theme is updated. One way to protect changes is to create a child theme. Even easier for CSS is to place any custom CSS you want in the Additional CSS panel of the customizer. Rules placed there become inline styles on the page and thus can take precedence over equivalent rules on theme stylesheets. Your rules added there are more likely to be properly applied without having to resort to !important modifiers or fiddling with selector specificities.

Viewing 1 replies (of 1 total)

The topic ‘Blog post aligned left’ is closed to new replies.