• Login
Community
  • Login

css formatting not working on embed style sheet at the begging of the style section in specific cases

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
2 Posts 2 Posters 233 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W
    wonkawilly
    last edited by wonkawilly Jun 2, 2024, 1:56 PM Jun 2, 2024, 1:46 PM

    Hi all
    I am getting a strange behavior on N++ while formatting some code.

    Situation:

    I created a html file and in it I added a <style> tag and some embed code to style the page.
    It is an all in one file that contains:

    • HTML
    • Javascript
    • CSS
      code
      When I need to edit the CSS code I activate CSS language from the menu Language > C > CSS, as shown into the following screenshot:
    • Img 1:
      a7265402-6ed6-4df9-9ea5-991a7b03270f-notepad++_5vhmvyJGsD.png

    and of course I do the same for Javascript and HTML codes.
    The problem manifests itself when in CSS mode as shown in the following screenshot:

    • Img 2:
      bc4e3b7b-1b94-488f-8f49-adbaa9d06bb7-notepad++_AkbhDs6Bog.png

    The big red curly bracket highlights the problem: as can be seen some code lines are not well formatted.

    Just moving the same lines after another css block / rule they get formatted correctly as shown below:

    • Img 3:
      c1236a0f-4423-48d4-a1bf-ee8018091e07-image.png

    So it seems that the problem affects only some css selectors, as the asterisk and body in my case (probably others? but I don’t know), when positioned at the start of the <style> section.

    In both cases they work as expected in the browser so the code seems correct as I understand it.

    Also creating a separated file for the css code alone, it is formatted correctly as shown in this last screenshot:

    • Img 4:
      4291ce40-8b79-4fed-892b-6fdff5da811c-image.png

    Questions:

    • What is the cause of the formatting issue shown by Img 2?
    • Someone else can replicate the issue?
    • How can I solve it?

    Thanks in advance.

    M 1 Reply Last reply Jun 3, 2024, 10:36 PM Reply Quote 0
    • M
      mkupper @wonkawilly
      last edited by Jun 3, 2024, 10:36 PM

      @wonkawilly said in css formatting not working on embed style sheet at the begging of the style section in specific cases:

      Someone else can replicate the issue?

      Please post an example for people to experiment with using the </> code thing that’s available in the forums.

      1 Reply Last reply Reply Quote 3
      2 out of 2
      • First post
        2/2
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors