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 addar du en radbrytning i WordPress (nytt radavstånd)

En användare frågade oss nyligen om det finns ett sätt att add to en radbrytning i WordPress eller justera radavståndet mellan blocken.

I de flesta ordbehandlare kan du enkelt add to extra blankrad genom att trycka på enter-knappen några gånger. Du kan också skapa linjer med dubbelt radavstånd efter stycken från alternativen för format. WordPress Block Editor har dock inte dessa knappar.

I den här artikeln visar vi dig hur du enkelt kan add to en radbrytning i WordPress.

How to Add a Line Break in WordPress

Innan vi börjar är det viktigt att veta att radavståndet styrs av det WordPress-tema som du använder.

Vi kommer att visa dig hur du addar mellanrum mellan block i block editor, och sedan kommer vi att täcka hur du ändrar radavståndet i ditt theme om du inte är nöjd med resultatet.

Video Tutorial

Subscribe to WPBeginner

Om du inte gillar videoklippet eller behöver fler instruktioner kan du fortsätta läsa.

Lägga till dubbla linjer mellan blocken

När du trycker på Enter-tangenten för Windows eller Return-tangenten för Mac på ditt tangentbord för att lägga till en radbrytning betraktar WordPress det som ett nytt stycke.

Det innebär att den automatiskt lägger till dubbelt radavstånd, förutsatt att your theme har styling för det (all bra themes för WordPress har det).

Adding double line spacing in WordPress

Gå helt enkelt till content type editor, tryck på Enter eller Return efter raden och skriv sedan något annat på nästa rad.

Genom att helt enkelt göra det, baserat på din theme styling, bör du se en clear skillnad mellan stycken.

Double line space added to create paragraph in WordPress

Lägga till enstaka radavstånd

Om du nu skriver något som gillar en adress, vill du förmodligen att det ska vara enkelt radavstånd istället för dubbelt radavstånd på din WordPress webbplats.

Single Space Preview

I detta fall måste du trycka på SHIFT + ENTER-tangenten i Windows eller SHIFT + RETURN-tangenten på Mac.

Detta kommer att tala om för WordPress att du vill börja en new rad inuti ett befintligt stycke. Därför behövs det enradigt radavstånd jämfört med dubbelradigt radavstånd.

Ändra line height och avstånd mellan linjerna

Ibland, även när du addar rätt radavstånd i Editor, visas det inte på det sätt som du vill ha det i your theme.

Det finns två sätt att fixa det:

  1. Använda ett tillägg (det enkla sättet)
  2. Manuellt med CSS-kod (mer avancerat)

Låt oss först ta en titt på den enkla metoden.

Lägga till radavstånd med hjälp av ett plugin

Om du vill göra stiländringar i ditt theme utan att behöva lära dig kod, är ett plugin som CSS Hero det bästa sättet att göra det.

CSS Hero gör det enkelt att ändra designen på din site i WordPress utan att kunna någon kod.

Add paragraph spacing in WordPress with CSS Hero

Du kan se mer detaljer i vår fullständiga CSS Hero review.

Om du vill göra större ändringar i ditt tema, gillar att flytta ett sidofält eller lägga till en footer, då skulle ett drag and drop page builder plugin vara ett bättre alternativ. Ett page builder plugin skulle också låta dig göra små tweaks som att ändra font färger eller lägga till radbrytningar i WordPress.

Vill du inte använda ett plugin, eller behöver du bara göra en enda ändring? Då kan alternativet med manuell CSS-kod vara bäst för dig.

Ändra styckeavstånd manuellt med CSS-kod

För att lägga till radbrytningar manuellt utan ett plugin måste du lägga till lite CSS i ditt theme.

CSS gillar i princip funktionen för format i Microsoft Word. Istället för att klicka på knappar kommer du att skriva vanlig CSS-kod. Det är ej så läskigt som vissa Beginnare kanske tror. CSS är mycket lätt att förstå om du bara följer instruktionerna.

För att add to custom CSS till your theme, måste du besöka sidan Appearance ” Customize. Detta kommer att starta WordPress tema customize, där du måste klicka på ”Additional CSS” tabs från den vänstra kolumnen.

Om du inte kan se dessa alternativ i menyn kanske du använder ett block theme. Vänligen se vår artikel om hur man fixar saknad theme customizer i WordPress admin.

Adding your custom CSS

I boxen custom CSS måste du add to följande CSS-kod:

.post p{line-height: 1.5em;}

CSS-regeln som visas ovan kommer att ändra radavståndet för styckeinnehåll till 1,5 em. Em är en breddenhet för typografi.

Vi använder .post class, som WordPress automatiskt addar till content area för all posts för att säkerställa att det endast påverkar posts och ej stycken som används på andra ställen.

Adding custom CSS to increase line height

Nu ändrar detta bara avståndet för enkelt avstånd.

Om du vill ändra styckeavståndet i WordPress (dvs. dubbelt avstånd), måste du add to padding.

.post p { 
line-height: 1.5em;
padding-bottom: 15px;
} 

Justera gärna siffrorna efter yours behov och add to dubbelt avstånd i HTML.

Du kan också add to custom CSS till din site med hjälp av WPCode plugin. Pluginet gör det mycket enkelt att inserta och hantera kod på din site.

För mer detaljer, vänligen se vår guide om hur du lägger till custom CSS på din WordPress site.

Vi hoppas att den här artikeln hjälpte dig att add to en radbrytning i WordPress. Du kanske också vill se vår guide om hur du använder WordPress block pattern och de bästa Gutenberg-vänliga WordPress teman.

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

99 kommentarerLämna ett svar

  1. Ralph

    This was huge problem back in old creator. I never knew how it will look like and had to hit preview every couple of lines but i think with gutenberg it is way easier and i learnd to just use shift+enter. I do this automatically and almost without consciousness. Don’t know why but some websites don’t allow shift+enter only enter or not and then I’m like ”WHY it is not working”!

  2. Deepak Sahani

    Superb video & post solved my query.

    • WPBeginner Support

      Glad our guide could be helpful! :)

      Administratör

  3. Jennyfer

    Thank you very much for thus information! Very useful. Just what I was looking for.

    • WPBeginner Support

      Glad our guide was helpful :)

      Administratör

  4. Colleen Cochran

    I finally figured out the shift-enter thing for poetry single space lines, but when the post is published and emailed to followers, it loses formatting and all the lines run together. How do I fix that?

    • WPBeginner Support

      You would want to check with the tool being used to send the notification for the styling for fixing that issue.

      Administratör

  5. Luiz

    Thank you! Very useful!

    • WPBeginner Support

      You’re welcome :)

      Administratör

  6. Robin

    So helpful! Thank you!!

    • WPBeginner Support

      You’re welcome :)

      Administratör

  7. Dhirendra

    Any option for reduce image gap…

  8. jan van den hoed

    Thanks for the explanation. One question though. How can i do the same thing on a smartphone. I’m editing my blog on the way and do not have a laptop available. i tried to do shift enter but that did not work

    • WPBeginner Support

      Due to the limitations of mobile, you would likely need to use the CSS method.

      Administratör

  9. Val

    Thank you so much, such a great help. I agonized over spacing!

    • WPBeginner Support

      Glad our guide was helpful :)

      Administratör

  10. Stephen

    Thanks, it helped a great deal.

    • WPBeginner Support

      Glad our article was helpful :)

      Administratör

  11. Douglas Daniel

    To change the CSS it’s telling me I have to purchase a premium plan. Am I out of luck?

  12. SOO

    Thank You! Helpful!!

    • WPBeginner Support

      You’re welcome, glad our article could help :)

      Administratör

  13. Rebecca

    I did not work for me. Any reasons it would not work?

    • WPBeginner Support

      If you’re using a page builder plugin they may have a different method for the single/double line spacing. Otherwise, it could be a plugin/theme conflict where you would need to disable your plugins and/or swap your theme to check

      Administratör

  14. Tim G

    I would like to reduce the spacing between normal paragraph lines — IMHO, there is too much white space by default. I’d also like to add a half line at the end of a paragraph, rather than a full line: Wordpress by default seems to just do the equivalent of a double carriage return which is rather twentieth century and doesn’t emulate what Word can do. Any ideas?

    • WPBeginner Support

      You would want to reach out to the support for your specific theme and they should be able to tell you what CSS needs to be added to reduce your line spacing :)

      Administratör

  15. sofar ahmad

    TQ so much

    very helpful

    • WPBeginner Support

      Glad our guide could be helpful :)

      Administratör

  16. Sumeet

    thanks that was what i was looking for it helped …

    • WPBeginner Support

      Glad our article helped :)

      Administratör

  17. Jen

    God bless you! I’m so grateful for you posting this with the CSS! Who knew that’s all it took for me to change the spacing! I’ve been looking for something like this for a long time! Thank you so much!

    • WPBeginner Support

      Glad our article could help you :)

      Administratör

  18. Kathy

    I am using the ”shift” enter method but it does not allow for different size font when I do. Is there a work around?

  19. Lora Staples

    GREAT video. Loved the content, pacing, and tone of the speaker. THANKS!

  20. Kunal Khandelwal

    Thank you so much for this suggestion. Didn’t know it was so easy :)

  21. phil rooksby

    I don’t have Additional CSS. I’ve tried all sorts of other ways to alter the paragraph spacing but nothing works, looks a real mess. Help please!!!

  22. Norm

    Thank you for the help. I have been looking all over the place, and wanted to do it with a plug-in. You made it so easy. Again, thank you very much.

  23. Maria

    Hello! I want to have a simple spacing between my paragraphs and even after pressing enter (for the double space), when I preview the draft nothing has changed (it’s still all one paragraph). Could anyone help?

  24. Rashmi

    Hi
    I would like to modifying the Line height and Spacing. However there is no ’editor’ icon ( Appearance » Editor) from theme’s CSS file.
    So, what can I do?
    Thank you for your reply!

  25. Hannah

    Wow. Didn’t know it was so easy. Thank you so much! This double space was driving me crazy! :D

  26. Christine

    Thank you! So much easier!

  27. Donna

    Thank you, thank you, thank you!

    I was in another html editor and could not figure out how to do single spacing.

    You saved the day! :)

  28. Gerard

    Brilliant and what an eternal lifesaver.

    I was struggling with spacing on one of my client sites and absolutely amazing that you had the exact answer almost at your finger tips. I am now becoming a permanent subscriber

  29. Elandre

    Thanks for all the Wordpress tips. This site has helped me a lot with most struggles I had

  30. LR

    I am using the Pilcrow theme and I have no idea how to make the double space between paragraphs happen. Sometimes it happens in my posts but sometimes it doesn’t. When I look in the HTML file I don’t see any post p or padding. I only see the end result of what the post will look like and thats when I know the double spacing didnt work. Can I still go back and re-edit and fix it? Last but not least where you say to go from the appearance to editor menus i dont have those options.
    I have under appearance the following options: themes, customize, widgets, menus, header, background, AMP, Theme Options, Mobile.
    Please help.

    • WPBeginner Support

      Hey LR,

      You can add the CSS by visting Appearance->Customize and then clicking on the Additional CSS tab in customizer. See our guide on how to add custom CSS in WordPress.

      If you believe it to be a theme issue, then try temporarily switching to a default WordPress theme. If the issue disappears, then you can ask your theme developer for support.

      Administratör

  31. Derek Cummings

    My theme is broken, as in it doesn’t have the double spacing by default. The theme is stuck on the shift+enter mode in other words. So in relation to the following code:

    .post p {
    line-height: 1.5em;
    padding-bottom: 15px;
    }

    Is 15px a normal default double space? How many pixels should it be by default? Also doesn’t it matter where I put this code? Thanx!

  32. Femi

    Thank you for the tip on the shift + enter. I never knew this for years. Your site has always been a rescue when I get stuck.

  33. Lyn

    Hello: How do you get custom line spacing (say, 1.5em) for one instance on one page instead of changing the entire theme CSS? I see two other people have asked the same thing with no response, at least not that I found. Thanks!

  34. Denise B

    I set the p margins to zero. In your CSS, it would be something like p {margins: 0; }

  35. Los Hundlos

    Shift+Enter to avoid huge gap between lines in wysywig tinye mce editor in wordpress. Works !!!! Awesome!

  36. Cat

    How about simply adding some text and changing the text colour to white (if the background is white)? This should make it possible to create and customise line spaces much easier (unless, of course, the background is a picture of something that cannot be matched with font colour).

  37. Tim

    Thanks so much! Life saver!

  38. Michael Rich

    Hi WPBeginner staff,

    I have a different question. I use Visual Composer and have added many Separator with Text dividers between my section headings on my homepage. I would like to make those text headings also be a link to that section.
    However everytime I add the link I lose the section identifying text that I had in the separator and it’s magically replaced with the default text saying ”TITLE”.

    To try to make it a link I am adding a the linking code inside this bracket:
    [vc_text_separator title=”1950s CARS”]

    I am scratching my head so hard that I think I’m bald. Any help will get you a lifetime of gratitude!!!

    Thankyou,
    Mike

  39. Anthony Cooper

    I am using the WordPress ’Divi’ theme and found that if you press enter (or shift + enter) twice, in order to create a larger space, it is ignored. To get round this press enter once, type a character on the line, (it does not matter what), highlight it and change the font colour of the character to white and then press enter again; this results in the desired space between lines without having to edit the theme. The same applies to extra spaces in a line; enter as many characters as desired, highlight them and change their font colour to white and then carry on in the desired font colour.

    • Julie

      Brilliant tip! Thanks so much for this, you saved me from lots of headaches and hassle Anthony!

      • Robin Brinkler

        Remember that some search engines could treat ”hidden” text like this as spam.

  40. Ellen

    This was really helpful, thanks!

  41. Christy

    THANK YOU!! I Love you guys! So glad I found this site! I’ve almost literally been banging my head against the wall. If I knew how to insert emojis, this post would be covered with hearts and smiley faces. :-)

    • Christy

      P.S. ~ HA! I did NOT know that my little colon and parentheses would actually turn into a smiley. LOL

  42. Linda Paul

    Oh yeah! You have just helped me solve a problem (forced single space paragraphs) that has vexed me for years!

  43. David M. Ebersole Sr.

    I am a subscriber to WP Beginner.
    I had a question concerning entering Engineering data for my product on my site. Spacing in the tables appeared too large on the page. I searched Wordpress support and all I saw was snippy responses to the question of single line spacing.

    Your the first to answer the question, and it obviously was correct. Thank You.

    Sincerely,

    Dave

  44. Mark

    What about on Android. The latest update has forced a double spacing (new paragraph). Not very good for poetry writers. Is there any way to revert it back to single?

  45. Cheryl

    I use Omega Theme and the control/enter does not work. Is there something else I can do. I cannot find post.p in the CSS file.

  46. Becky

    Very helpful, thank you!

  47. Adnan Khan

    Thanks, this most useful Tip for new wp user

  48. Tina Gleisner

    Thanks for the ”shift” and enter for single line spacing as I’ve wanted to figure this out for years … and never got around to finding the solution.

  49. Ian

    Hi,
    This worked for me but the CSS doesn’t do anything in my page…

    • Will

      Same thing happened to me. Is there an updated code to insert?

  50. A. Lougheed

    I’m searching everywhere for an answer … when I add a in the text editor, it is removed in the visual editor. Drives me crazy. Does wpbeginner have a recommendation?

    Should I add a plug-in to stop this?

    I tried a plugin years ago, but I had to go back and re-format every post.

    Any link with tutorial or advice is greatly appreciated!

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.