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

Jak dodać podział wiersza w WordPress (odstępy między wierszami)

Niedawno jeden z użytkowników zapytał nas, czy istnieje sposób na dodanie podziału wiersza w WordPress lub dostosowanie odstępów między blokami.

W większości edytorów tekstu można łatwo dodać dodatkowe odstępy między wierszami, naciskając kilkakrotnie klawisz wpisz. W opcjach formatowania można również tworzyć podwójne odstępy między wierszami po akapitach. Jednak edytor bloków WordPress nie ma tych przycisków.

W tym artykule pokażemy, jak łatwo dodać podział wiersza w WordPress.

How to Add a Line Break in WordPress

Zanim zaczniemy, warto wiedzieć, że odstępy między wierszami są kontrolowane przez używany motyw WordPress.

Pokażemy ci, jak dodać odstępy między blokami w edytorze bloków, a następnie omówimy, jak zmienić odstępy między wierszami w twoim motywie, jeśli nie jesteś zadowolony z wyników.

Film instruktażowy

Subscribe to WPBeginner

Jeśli nie podoba Ci się film lub potrzebujesz więcej instrukcji, czytaj dalej.

Dodawanie podwójnej linii odstępu między blokami

Po naciśnięciu klawisza Enter w systemie Windows lub klawisza Return w systemie Mac na klawiaturze, aby utworzyć podział wiersza, WordPress traktuje go jako nowy akapit.

Oznacza to, że automatycznie doda podwójny odstęp między wierszami, pod warunkiem, że twój motyw ma odpowiednią stylizację (wszystkie dobre motywy WordPress to robią).

Adding double line spacing in WordPress

Wystarczy przejść do edytora treści, wpisz klawisz Enter lub Return po linii, a następnie wpisz coś innego w następnej linii.

W ten sposób, w oparciu o styl twojego motywu, powinieneś zobaczyć wyraźne rozróżnienie między akapitami.

Double line space added to create paragraph in WordPress

Dodawanie spacji jednowierszowej

Teraz, jeśli piszesz coś takiego jak adres, to prawdopodobnie chcesz, aby był on pojedynczo, a nie podwójnie na twojej witrynie WordPress.

Single Space Preview

W takim przypadku należy nacisnąć klawisze SHIFT + ENTER w systemie Windows lub SHIFT + RETURN w systemie Mac.

To powie WordPressowi, że chcesz rozpocząć nową linię wewnątrz istniejącego akapitu. W związku z tym potrzebny jest odstęp między pojedynczymi wierszami, a odstęp między podwójnymi wierszami.

Modyfikowanie wysokości linii i odstępów

Czasami, nawet po dodaniu odpowiedniego odstępu między wierszami w edytorze, nie wyświetla się on tak, jak chcesz w twoim motywie.

Poprawkę można naprawić na dwa sposoby:

  1. Korzystanie z wtyczki (prosty sposób)
  2. Ręcznie z kodem CSS (bardziej zaawansowane)

Przyjrzyjmy się najpierw prostej metodzie.

Dodawanie odstępów między wierszami za pomocą wtyczki

Jeśli chcesz wprowadzić zmiany stylu w twoim motywie bez konieczności uczenia się kodu, najlepszym sposobem na to jest użycie wtyczki takiej jak CSS Hero.

CSS Hero ułatwia zmianę wyglądu twojej witryny WordPress bez znajomości jakiegokolwiek kodu.

Add paragraph spacing in WordPress with CSS Hero

Więcej szczegółów można znaleźć w naszej pełnej recenzji CSS Hero.

Jeśli chcesz wprowadzić większe zmiany w twoim motywie, takie jak przeniesienie panelu bocznego lub dodanie stopki, lepszym rozwiązaniem będzie wtyczka do tworzenia stron typu „przeciągnij i upuść „. Wtyczka do tworzenia stron umożliwia również wprowadzanie drobnych modyfikacji, takich jak zmiana kolorów pisma lub dodawanie podziałów wierszy w WordPress.

Nie chcesz używać wtyczki lub potrzebujesz tylko tej jednej zmiany? W takim razie opcja ręcznego kodu CSS może być dla ciebie najlepsza.

Ręczna zmiana odstępów między akapitami za pomocą kodu CSS

Aby dodać podziały wierszy ręcznie bez wtyczki, musisz dodać trochę CSS do twojego motywu.

CSS jest w zasadzie jak funkcja formatowania w Microsoft Word. Zamiast klikać przyciski, będziesz pisać zwykły kod CSS. Nie jest to tak przerażające, jak może się wydawać początkującym. CSS jest bardzo łatwy do zrozumienia, jeśli tylko postępujesz zgodnie z instrukcjami.

Aby dodać własny CSS do twojego motywu, musisz przejść na stronę Wygląd ” Dostosuj. Spowoduje to uruchomienie konfiguratora motywu WordPress, w którym należy kliknąć kartę „Dodatkowe CSS” w lewej kolumnie.

Jeśli nie widzisz tych opcji menu, być może używasz motywu blokowego. Zapoznaj się z naszym artykułem na temat poprawki brakującego konfiguratora motywu w panelu administracyjnym WordPress.

Adding your custom CSS

W polu własnego CSS należy dodać następujący kod CSS:

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

Przedstawiona powyżej reguła CSS zmieni odstępy między wierszami treści akapitu na 1,5em. Em to jednostka szerokości w typografii.

Używamy klasy .post, którą WordPress automatycznie dodaje do treści wszystkich wpisów, aby mieć pewność, że ma ona wpływ tylko na wpisy, a nie na akapity używane w innych miejscach.

Adding custom CSS to increase line height

Teraz zmienia to tylko odstępy między pojedynczymi odstępami.

Jeśli chcesz zmienić odstępy między akapitami w WordPress (tj. podwójne odstępy), musisz dodać dopełnienie.

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

Możesz dostosować liczby do swoich potrzeb i dodać podwójne odstępy w HTML.

Możesz również dodać własny CSS do swojej witryny za pomocą wtyczki WPCode. Wtyczka bardzo ułatwia wstawienie i zarządzanie kodem na twojej witrynie.

Aby uzyskać więcej informacji, zapoznaj się z naszym przewodnikiem na temat dodawania własnych CSS do twojej witryny WordPress.

Mamy nadzieję, że ten artykuł pomógł ci dodać podział wiersza w WordPress. Możesz również zapoznać się z naszym przewodnikiem na temat korzystania ze wzorca bloków WordPress i najlepszych motywów WordPress przyjaznych dla Gutenberga.

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.

Ujawnienie: Nasze treści są wspierane przez czytelników. Oznacza to, że jeśli klikniesz na niektóre z naszych linków, możemy otrzymać prowizję. Zobacz jak WPBeginner jest finansowany, dlaczego to ma znaczenie i jak możesz nas wspierać. Oto nasz proces redakcyjny.

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.

Najlepszy zestaw narzędzi WordPress

Uzyskaj BEZPŁATNY dostęp do naszego zestawu narzędzi - zbiór produktów i zasobów związanych z WordPressem, które każdy profesjonalista powinien mieć!

Reader Interactions

100 komentarzyZostaw odpowiedź

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. 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!!!

  3. 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.

  4. 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?

  5. 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!

  6. Hannah

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

  7. Christine

    Thank you! So much easier!

  8. 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! :)

  9. 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

  10. Elandre

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

  11. 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.

      Administrator

  12. 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!

  13. 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.

  14. 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!

  15. Denise B

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

  16. Los Hundlos

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

  17. 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).

  18. 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

  19. 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.

  20. Ellen

    This was really helpful, thanks!

  21. 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

  22. Linda Paul

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

  23. 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

  24. 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?

  25. 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.

  26. Adnan Khan

    Thanks, this most useful Tip for new wp user

  27. 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.

  28. 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?

  29. 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!

  30. Jessica

    Whats the code for adjusting line height for one single post?

  31. Samadarshi

    Thank you for such wonderful articles
    I was completely lost when I started wordpress but now I have a pretty basic idea
    Thank u :)

  32. Neal Umphred

    Thanks! This helped me tighten up my posts—except for the first paragraph in each post. For some reason, the lines appear to be double-spaced. Is there a snippet of code that I could add to Edit CSS that would allow me to tighten them?

  33. Neal Umphred

    Thanks! Adding the snippet (.post p{line-height: 1.5em;}) to my Edit CSS made my text so much easier to read. Now, here’s my problem: the opening paragraph in each WordPress post has much larger line spacing than the rest of the paragraphs—and it is NOT affected by this piece of line-height code. Is there another snippet of code that I could add to Edit CSS that would tighten up those opening lines?

  34. tiffany

    Thank you so much. Your site is remarkable. It has helped me so much. Subscribed!! Please keep up the great work!!

  35. Joe Simmons

    Thank you! I didn’t know about the „shift+enter” thing either.

  36. Debby

    Shift + Enter. Who knew it was that simple! Thank you, thank you, thank you!

  37. Gamo Nana

    thanks for the single line spacing with SHIFT + Enter

    • Bob M.

      I’d like to thank you for this bit of wisdom (Shift+Enter) too!

  38. JE

    Thanks for the tutorial. Although, how can I adjust single paragraph line spacing? I have a 3 word title, centered and stacked in 3 lines. All of the lines have different font size, so the line spacings are inconsistent. I’ve been looking for a way to easily adjust through a text editor tool or plugin.

    Any ideas?

  39. Mx

    Finding .post p you used a search box. Will you tell me how to find that search box? Thanx4

  40. Jun Han

    This is very helpful.
    Thanks.

  41. Karen Surfy Mum

    Awesome!! I also have wanting to find out how to do this for ages!!! So simple when you know… cheers xxx

  42. Widdershins

    Oiiiiiiiiiiii!!! I’ve been trying to find out how to do that for yonks!!!!
    Thankyouthankyouthankyou :D

  43. fastow2012

    „If you do not find the .post p tag, then simply create one.”
    Where? should i just copy/paste it anywhere in the css file?

      • Mx

        Sorry, but I still dont get where to place it. Is is possible to explain it more detailed? Thanx

  44. James

    I’ve always wondered how to do this. Thanks for the training.

  45. Valerie

    I’m not even a true „beginner” but there are gaps in my knowledge and you have just solved one of the most frustrating things about WP for this writer and Word user… Thank you for this and for all your fantastic info… I continue to learn great things from your posts and your site. Thanks and cheers to you!

  46. kelly

    almost four years of blogging and finally! :) so awesome, thanks!!

Zostaw odpowiedź

Dziękujemy za pozostawienie komentarza. Pamiętaj, że wszystkie komentarze są moderowane zgodnie z naszymi polityka komentarzy, a Twój adres e-mail NIE zostanie opublikowany. NIE używaj słów kluczowych w polu nazwy. Przeprowadźmy osobistą i konstruktywną rozmowę.