stylesheet
-
Bonjour, je debute le code, j’essair de cree un premier site pour decouvrir.
Je bloque deja sur 2 choses:- j’ai ecrit doctype mais il ne se mets pas en surbrillance je ne sait pas pourquoi.
- je veut relier mon css au html, mais pareil pas de surbrillance et surtout ca ne marche pas.
Quelqu’un a til le temp de m’aider svp ?
-
@G-H2LLS said:
Hello, I start the code, I try to create a first site to discover.
I am already stuck on 2 things:I wrote doctype but it doesn’t highlight I don’t know why.
I want to link my css to html, but the same does not highlight and above all it does not work.
Does anyone have time to help me please?See HERE.
-
@Alan-Kilborn ok désolé, j’ai besoin d’apprendre et je pensai que quelqu’un pourrait m’aider… connaissez vous un site ou je pourrai avoir une réponse ? parce que je suis bloquer et je ne trouve pas mon erreur.
notepad++ prend bien en compte le stylesheet ?
Est-ce mon erreur ou peut être pas le bon logiciel ?
je n’ai pas encore assez de connaissances. -
@G-H2LLS ,
The reason @Alan-Kilborn suggested you find another forum is because your phrasing – at least when Chrome auto-translates from your original language into the English that we read the forum as – makes it sound like you are asking a question about how to make an HTML link to a CSS file. We are not an HTML help forum, and will not help you with that.
However, when I look at your screenshot, and look at the word in your original post that translates into “highlight” in English, I wonder if you’re not asking about why Notepad++'s syntax highlighting isn’t doing what you expect while you are editing your HTML file in Notepad++ – and we can answer that.
First, let me number four things in the screenshot:
-
I assume the highlighting of
<!doctype html>
is what you were referring to when you said “I wrote doctype but it doesn’t highlight”. If you look inside, you will see that the<!
and>
are highlighted with light blue background.- This is exactly the style defined by the default stylers.xml in the Style Configurator > HTML > SGMLDEFAULT foreground (black) and background (light blue):
- The
doctype html
portion of the HTML doctype identifier gets styled with the Style Configurator > Global Styles > Default Style > Foreground colour:
(personally, if I were designing the HTML lexer, I would have defined a separate color style for the text of the internals of the<!doctype html>
… or at least given it the same style as SGMLDEFAULT…)
- This is exactly the style defined by the default stylers.xml in the Style Configurator > HTML > SGMLDEFAULT foreground (black) and background (light blue):
-
Your
<title>...</title>
tag does not have syntax highlighting because you misspelled it as<tittle>
. -
You are missing an end-quote on your
content="..."
attribute -
Because of that missing end-quote, the start of
<link rel=
will look purple, the color of a quote, because it’s still inside the quote. Then thestyesheet
will be black as an unknown attribute of the not-yet-closed<meta ...
tag.
If you fix your HTML to be valid HTML, then Notepad++ will correctly syntax highlight:
So, in the end, the two root causes of your problems:
- You didn’t understand how Notepad++ highlights the
<!DOCTYPE html>
, so you thought it wasn’t highlighting it: but it is. - You had mistakes in your HTML. Notepad++ does its best to syntax highlight HTML, but when there are mistakes in the HTML, it cannot guess what you actually meant, so the highlighting doesn’t make sense.
In the future, if Notepad++ is not highlighting your HTML correctly, the first thing you should think is “what’s wrong with my HTML”.
If you have questions about HTML or CSS, those questions belong in another forum (maybe one of the Stack Exchange family of sites).
But if you have questions on the specifics of Notepad++, then you may feel free to ask here.
-
-
@PeterJones said in stylesheet:
personally, if I were designing the HTML lexer, I would have defined a separate color style for the text of the internals of the <!doctype html>… or at least given it the same style as SGMLDEFAULT…
Actually, it turned out that the authors of Scintilla/Lexilla (the library that Notepad++ uses internally for doing the syntax highlighting) does have a separate style for that. Oddly, it’s internally called SCE_H_SGML_ERROR, which is StyleID=
26
.So if you want to be able to define the colour used for the
doctype html
portion of<!doctype html>
line, then do the following:- Exit all instances of Notepad++
- Run one instance of Notepad++
- Open the file
%Appdata%\Notepad++\stylers.xml
- if you use a style other than
Default (stylers.xml)
, then you will want to go into the%AppData%\Notepad++\Themes\
directory and edit the XML file for that theme, rather than editing thestylers.xml
theme.
- if you use a style other than
- look for
<LexerType name="html" ...>
- in that section, add
<WordsStyle name="SGML_DOCTYPE_TEXT" styleID="26" fgColor="FF0000" bgColor="A6CAF0" fontName="" fontStyle="0" fontSize="" />
on the line after<WordsStyle name="SGMLDEFAULT".../>
- Save
- Exit Notepad++
- Run Notepad++
- Now if you look at your HTML file, it will be highlighted as the following:
- So if you change Style Configurator > HTML > SGML_DOCTYPE_TEXT from now on, it will change the highlighting for that
-
@PeterJones merci d’avoir pris du temps pour me repondre, je suis Francais et je ne parle pas encore anglais. Merci
-
@G-H2LLS said in stylesheet:
thank you for taking the time to answer me, I’m French and I don’t speak English yet
The standard language of this forum is English. So if you post in your native language, we have to translate your post into our own language, using our browser’s “Translate this page” tool or by pasting the contents of a post into an external translator like translate.google.com or deepl.com. So if you are having trouble understanding our English replies, you can similarly use your browser’s translate function or an external translation site to translate the answer back to French so you can understand it.
…
La langue standard de ce forum est l’anglais. Donc, si vous postez dans votre langue maternelle, nous devons traduire votre message dans notre propre langue, en utilisant l’outil “Traduire cette page” de notre navigateur ou en collant le contenu d’un message dans un traducteur externe comme translate.google.com ou deepl.com. Ainsi, si vous avez du mal à comprendre nos réponses en anglais, vous pouvez de la même manière utiliser la fonction de traduction de votre navigateur ou un site de traduction externe pour retraduire la réponse en français afin de la comprendre.
Traduit avec www.DeepL.com/Translator (version gratuite)