Search code examples
htmlcssalignmentnotepad++preview

Notepad++ text alignment


I am trying to create a simple document after recently starting to learn HTML and CSS. I am using Notepad++ with the plugin "Preview HTML".

The problem is the text in the preview window is centered by default(meaning i have to insert text-align to render any text left).

However, when I open my HTML file in a browser (without text-align), it displays text to the original left alignment.

Any idea how I can change the default text alignment in the "Preview HTML" window to left?

Below are screenshots depicting the problem

Preview in "Preview HTML"

Preview in Google Chrome


Solution

  • I tried what you gave, and the reason is improper closing <h2> tag. You missed the forward-slash sign while closing. Causing the <h2> tag to never end and the below <p></p> tag was treated as enclosed inside this and thus style for parent tag i.e. .heading class got applied to the child tag of <p>

    <h2 id="heading">Testing<h2>
    

    should be

    <h2 id="heading">Testing**</h2>**
    

    for it to work.

    screenshot of corrected html is below enter image description here screenshot showing what happened actually in DOM enter image description here