Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här lägger du till och justerar images i WordPress Block Editor (Gutenberg)

Images ger liv åt dina WordPress posts och pages genom att göra dem mer engagerande. Men många Beginnare kämpar med att rikta in images precis som de gillar.

Den nya WordPress Block Editor (Gutenberg) löser detta problem genom att göra det lättare att add to och justera images i WordPress.

I den här artikeln visar vi dig hur du enkelt kan lägga till och justera images i WordPress för att skapa beautiful layouts för content.

Adding and properly aligning images in WordPress

Justering av images i WordPress Editor

Tidigare använde WordPress en textredigerare med knappar för redigering som standard editor. En viss issue i den gamla Editorn var justeringen av images. Det kan vara svårt att få saker korrekt uppradade på din website i WordPress.

Även om det fanns alternativ för att justera images till vänster, höger eller centrerat, såg det inte alltid bra ut. Ibland var images inte i linje, hade inte exakt rätt storlek eller såg helt enkelt konstiga ut.

WordPress 5.0 introducerade en new editor för WordPress-poster som anropas Gutenberg block editor. Det fixade flera problem med den gamla editorn, inklusive problem med justering av images.

Låt oss ta en titt på hur du enkelt kan lägga till och justera images i den nya Editorn för att skapa beautiful layouts för din WordPress bloggs inlägg och pages.

Lägg till och justera images i WordPress

Editorn levereras med följande block som du kan använda för att add to images i dina posts och pages i WordPress.

  • Imagely
  • Inline Image
  • Gallerier
  • Media & text
  • Cover

Låt oss börja med ett enkelt image block först.

Klicka på knappen ”Add new block” eller skriv /image i post editor för att inserta ett block med en image.

Adding a new image block in WordPress post editor

Du kommer att se tre knappar inuti det tomma image blocket.

You can upload an image from your computer, select an already uploaded image from the media library, or insert an image by providing the image file URL.

Klicka sedan på knappen ”Upload” och välj sedan den image som du vill uploada från din dator.

Så snart du har valt bilden kommer WordPress att uploada den till ditt mediabibliotek och infoga den i bildblocket.

Image alt text

Now, you will notice a toolbar on top of your image and some image block settings in the right column.

För att justera din image använder du toolbaren som visas högst upp på bilden.

Image alignment buttons in WordPress post editor

Blocket Image ger dig följande alternativ för justering av bilder som knappar i toolbaren.

  • Justera vänster
  • Justera centrerat
  • Justera höger
  • Bred Bredd
  • Full Width

If your image is smaller in width, then aligning it to the left or right will bring up text next to the image. Om den är centrerad visas imagen på en egen row utan text på någon av sidorna.

Center align an image in WordPress

Om du väljer alternativet ”wide width” blir din image bredare än textarean.

Alternativet full width gör att den hamnar i höger och vänster kant av webbläsarens vy.

Making an image full-width in WordPress

Så här justerar du en image perfekt bredvid text

Många gånger kan du behöva justera en image perfekt bredvid en text. WordPress Block Editor gör detta enkelt genom att lägga till Media & Text-blocket.

Detta block lägger i princip till ett område med två Column. En Column för images (media) och den andra Column för text content.

Media and text block in WordPress post editor

Det är bara att uploada din image.

Sedan kan du add to den text som du vill visa bredvid.

Image and text block settings

När du har lagt till image och text kommer du att notera fler alternativ för blocket. Du kan göra hela blocket bredare eller full width, och du kan också byta sida på image och text.

Justeringen av imagen anpassas automatiskt till höjden på texten i nästa column.

Image size adjusts to align vertically

Så här justerar du bilder i gallerier i WordPress

WordPress block editor kommer också med ett block för att add to image galleries. Detta allow you att enkelt visa images i ett grid av rows och columns.

Blocket Gallery har liknande alternativ för justering i toolbaren.

You can make the entire gallery block align to the left, center, or right. Du kan också göra det brett eller ändra det till en full width row.

Align gallery images in WordPress post editor

Den utvalda funktionen för gallerier i WordPress är ganska bra. Men om du regelbundet addar fotogallerier till dina posts och pages i WordPress, bör du överväga att använda ett plugin för fotogalleri som Envira Gallery.

Dessa tillägg ger dig fler alternativ för att justera images i dina gallerier, visa dem i popup och utforma dem på olika sätt.

Så här addar du två images sida vid sida i WordPress

Det enklaste sättet att displayed två images sida vid sida i en WordPress post är genom att lägga till båda images i ett Gallery block.

Display two images side by side in WordPress posts and pages

Välj bara en 2-column layout för gallery blocket för att visa båda bilderna bredvid varandra. Du kan också kontrollera alternativet ”crop thumbnail” för att se till att båda bilderna har samma storlek.

Fler sätt att lägga till och justera images i WordPress

Förutom blocken image, media och text samt gallery kan du också använda blocket Cover för att add to en cover image.

I modern webbdesign används cover images för att skapa mycket engagerande layouts för content. Dessa images används för att framhäva olika sections på en page.

Blocket med cover image har samma alternativ för justering som ett image-block. You can add text over the image and choose an overlay color from the block settings. Det bästa är att du kan kontrollera alternativet ”Fixed Background”, vilket skapar en parallaxbakgrundseffekt.

Cover image in WordPress

Om du vill veta mer om hur du använder omslagsbilder kan du kontrollera vår artikel om skillnaden mellan featured images och cover image i WordPress.

Hittills har vi pratat om att lägga till images direkt i dina posts och pages. Hur är det med images från webbplatser från tredje part?

Block Editor gör det också enkelt. You can add images from popular social sharing sites, including Instagram, Facebook, Flickr, Imgur, Photobucket, and more.

Om du till exempel vill lägga till ett Instagram-foto lägger du bara till Instagram-blocket i post editor och enter URL: en till den post du vill dela.

Instagram embed in WordPress

Sedan kan du bara klicka på den justering du vill ha i toolbaren. Med Embed Blocks kan du också enkelt bädda in videoklipp i WordPress.

För mer detaljer, vänligen se vår guide om hur du embedar Instagram i WordPress.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du enkelt lägger till och justerar images i WordPress block editor. Du kanske också vill se vår guide om hur du optimerar images för att snabba upp WordPress och den bästa designprogramvaran.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

63 kommentarerLämna ett svar

  1. Jiří Vaněk

    Gutenberg is still a big unknown for me. I’ll admit that I only started discovering it after WordPress 6.4 arrived and reading these pages. For a long time, for example, I could not figure out how to place an image and text next to each other (in Elementor it was a completely simple matter). After reading this article, I can do a little more with Gutenberg. Thanks for that.

    • WPBeginner Support

      You’re welcome :)

      Administratör

  2. fred dugas

    will this work with Iframes? I edit a custom HTML block and add iframe and the save and the add is lining up all the way to the left where all the other blocks are centered.?

    • WPBeginner Support

      It would depend on the iframe but normally iframes will not automatically have alignment options.

      Administratör

  3. Harry Goldhagen

    How do you align Featured Images that appear on the automatically generated Blog page and Category page? Clicking on the image opens the post, and there doesn’t seem to be an alignment setting for Featured image when filling in the post settings.

    • WPBeginner Support

      For the featured image, that would be determined by your theme. If you check with your specific theme’s support they should be able to assist with the alignment of your featured image.

      Administratör

  4. john McIntyre

    I wish to have all captions on my site, the same size and font.
    How is this achieved?

    • WPBeginner Support

      Unless your theme has a specific setting for it, most themes should have the text uniform if it is all the image caption and not a different text block.

      Administratör

  5. Sharon

    I’m wanting to change the default for uploading an image to be centred every time. To change each image I upload to centre each time I add an image is so time consuming. Can I change the default to centre?

    • WPBeginner Support

      There is not a simple method we would recommend for beginners at the moment but we will keep an eye out for something we would recommend.

      Administratör

  6. Amanda A.

    I am trying to use the Block Editor to display two images side by side. I used the two column feature then image blocks in each column. While designing, it displays correctly, but when I ”preview in new tab”, the side by side columns are gone and the images are stacked. What am I doing wrong? Is this a common issue? How can I fix this?

    • WPBeginner Support

      You may want to ensure the images aren’t too large for them to be side by side in your specific theme for the most common reason for that issue.

      Administratör

  7. Sheryl Zeiset

    I’m trying to learn how to use the new block editor. When I click on the Add block button and choose image to add a photo, I only get the ’insert from URL’ option and I can’t find a way to add photos from my Media Library. Can you help?

    • WPBeginner Support

      You would want to check closely to find the text next to the upload button for selecting the image from your media library

      Administratör

  8. Luther Mckinnon

    I have been publishing a blog for many years. I have learned to dread the introduction of a new system. Doing a simple thing like adding photographs is now very difficult.

    • WPBeginner Support

      Hopefully, once you are comfortable with the new system it becomes easier for you :)

      Administratör

  9. Ward

    Great information, problem is that back end it works but front end it always aligns to the left. Would it be possible that this has something to do with my Elementor template?

    • WPBeginner Support

      If you are using a page builder there is a chance that your page builder is overriding the styling and you can reach out to your builder’s support for assistance.

      Administratör

  10. tanmay

    absolutely amazing feature its not every cup of tea to use HTML editor

    • WPBeginner Support

      Glad you like the block editor feature :)

      Administratör

  11. Louie Adem

    just started WordPress yesterday. Totally a beginner and so happy wpbeginner provided me the ”trainer wheels” to jumpstart. The education in this website is so valuable. Can’t thank you enough.

    • WPBeginner Support

      Glad we could help get you started :)

      Administratör

  12. BadlyDrawmWolf

    Thank you for this little gold nugget – really struggling getting in to the ”new” way of handling my blog and almost giving up and searching for other alternatives…. :)

  13. Karen

    You mention ”Inline Image”, but I don’t see any such block. Your article was written awhile ago but supposedly updated in Jan. 2020 – did that block go away and you forgot to remove it from this article? Or a better question: How can I add an inline image within another block like Paragraph or Heading?

    • WPBeginner Support

      The inline image block is not currently available but you can normally recreate the formatting with the text and image or the standard image block

      Administratör

  14. Ted Strutz

    When I add an image from my media the image toolbar does not come up to align left or right. I can change size of image.

    • WPBeginner Support

      You would want to ensure you have not set it to be at the top of the page instead of how we have it at the moment.

      Administratör

  15. Hannah

    Hello, I have aligned all images using the block editor and everything looks fine until I preview?

    Then some images have become far bigger than the others, I have a gallery of two images suddenly sitting on top of a single image. Everything has moved around randomly!

    Even when I published it, it was still all wrong. I would love your help, thank you!

    • WPBeginner Support

      You would want to reach out to your theme’s support to ensure there isn’t a styling conflict, otherwise, you could try disabling your plugins to see if this is a plugin conflict as well.

      Administratör

  16. Harry

    Hi, I’m looking to align shortcodes next to one another like you describe with the images is this possible? Many Thanks

    • WPBeginner Support

      That would depend on the shortcodes themselves

      Administratör

  17. Ap

    Hello,
    How do you arrange the positioning of the title for the cover blocks?

    You have that option in your bar, but for some reason, when I click on cover block, there is no text alignment option.

    Any ideas on this?

    Thank you for the great article.

    • WPBeginner Support

      You would want to check the top of your page as that would be the other location the alignment options would be rather than floating over the element

      Administratör

  18. Cheryl

    How do you make an image clickable with a clickable link? I’ve been looking for tutorials and they all seemed based on a prior Gutenberg block which since has changed an the tutorials no longer match the block.

    • WPBeginner Support

      You would want to check the top toolbar for the current location for where to add a link to an image

      Administratör

  19. Alejandro

    Hello, Is it possible to write an image caption right below the image when using the ”Media & Text block”?

    • WPBeginner Support

      It would depend on your specific theme for the styling but you should be able to

      Administratör

  20. Lancer Kind

    Nice! Thank you so much!

    • WPBeginner Support

      You’re welcome :)

      Administratör

  21. Pete Newman

    There is an existing issue of incompatability between Gutenberg and themes. Do you have a list of themes that are compatable with Gutenberg (and that allow full functionality of Gutenberg)?
    Thanks and regards,
    Pete.

  22. Pete Newman

    I have been using wordpress for years but have been a bit absent lately. Gutenberg is a headspin. I follow these instructions but simply cannot align images in an image/text block. When I go to preview the image is aligned extreme hard left of the page with no margin at all. Any solutuions on offer?
    Thanks!!

      • Pete Newman

        Thank you! Excellent support. I added the classic editor plugin and the disable Gutenberg plugin and was able to create an approximation of what I want. Looking forward to Gutenburg functioning as intended and developers catching up – it is a great idea.

        • WPBeginner Support

          Glad we could help :)

  23. Jimmie

    But you can’t link images in a gallery? That makes the gallery function less attractive

    • WPBeginner Support

      If each image needs its own link then setting up columns would likely be what you’re looking to do :)

      Administratör

  24. Roxana Snedeker

    What is the best way to add multiple images at once, I can’t seem to add more than one at the time :(

    • WPBeginner Support

      If you want to add multiple images in the same area, you would want to take a look at the gallery block to add multiple images in one section

      Administratör

  25. Aaranja

    How to add an image directly in the ”Code Editor”, without passing by ”Visual Editor”?

    • WPBeginner Support

      You could disable the visual editor under Users>Your Profile but that would prevent you from using the visual editor for other sections.

      Administratör

  26. Alice

    I’m centering all of my images correctly in the editor, but they are all showing up as left-aligned in preview and live posts no matter what. Do you know what might be causing this? It’s driving me so crazy!

    • WPBeginner Support

      Your theme may be overriding the styling you are setting. If you reach out to your theme’s support they should be able to assist.

      Administratör

  27. Anne

    I would like to have an image next to a file (pdf) – all on the same line. Can I do that in one block, or would I need to create two? Thank you!

    • WPBeginner Support

      You would want to add the column block to split the content and allow you to display the content like that.

      Administratör

  28. Suzy Algar

    I am having creating captions for images and downloads that appear in my files. I don’t know where to go once I have the image in my files.

    • WPBeginner Support

      If you’re trying to add the image to a post or page you would normally add an image block and then select the file you want to use in the block

      Administratör

  29. Roxana Safipour

    So now how do you do ”no alignment”, where the image is on the left and has no text wrapping around it? This used to be easy with the no alignment option, which is now gone. Please bring this back! I am going crazy trying to figure out how to get my image on the left (not centered) and with no text next to it, but the text keeps wrapping around it automatically!

    • WPBeginner Support

      For what it sounds like you’re wanting, if you don’t specifically set the alignment for an image, the image should set itself that way.

      Administratör

      • Ben

        Just a quick followup on this, as it was annoying me as well. There’s a simple answer but it’s sort of not that obvious as I was looking for a setting – just press the selected alignment button again to turn off the alignment and revert to the default no alignment.

  30. Jesse

    Great post very useful.I have ugrade to wordpres 5.1 but now have problem with linking image to url. Can you help me?

    • WPBeginner Support

      If you’re using the block editor, in the image block’s settings there should be a Link Settings section for you to set where an image links to.

      Administratör

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.