skip to Main Content

In the image below there are empty lines before the head, body and closing /html tags and within the body tag I want to remove. How?

html file with empty lines

3

Answers


    • put cursor at end of line with text
    • press Shift-ArrowRight as many times till cursor at pos 1 selecting all newlines till next text
    • Ctrl+Shift+L to select all similar parts
    • ArrowRight
    • Backspace as much times as needed
    • Esc to leave multi cursor
    Login or Signup to reply.
  1. According to your screenshot, you can try to reduce the line height to reduce the gaps between two successive lines.

    1. Open Settings
    2. Type Line height in the search bar
    3. Specify your desired line height

    And done.

    Also you could try reducing your font size which would automatically decrease the line height thus reducing gaps in between successive lines.

    Settings section of VS Code editor

    Login or Signup to reply.
  2. Use nn* in the Find Widget (Ctrl+H) with the regex option (.*) icon enabled, replace with n. Replace All.

    or better change this setting:

    // List of tags, comma separated, that should have an extra newline before them. `null` defaults to `"head, body, /html"`.
    `HTML > Format: Extra Liners`
    

    In your settings.json:

    "html.format.extraLiners": ""  // just leave empty
    

    Now when you format the html file those empty lines above head/body/html should be removed (select all and Command Palette: Format Selection).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search