HTML Script tag self closing? - html

Can script tags in HTML be closed by simply using:
<script src="https://abc.js"/>
Or do I have to close this script tag like so:
<script src="https://abc.js"></script>
The reason I ask is because in sublime text 3 i have a highlighting problem that is slightly annoying. For example:
Indented with Tags
Yet when i remove the tag and self close it by "/>" you can see the horrible background highlighting issue goes away.
No indentation but highlighting disappears on line 1
I understand that a separate closing script tag is the standard way to close tags but why is it causing a change of font colour and background highlighting issue.
P.S. in the image it isn't shown very well but in contrast to the rest of the background, the whole line is highlighted a different colour and I cant seem to solve it.

Related

HTML and CSS codes to be together color highlighted in one .html project

I am doing HTML/CSS as beginner and when I add an simple CSS styled button code in my HTML file it won't highlight that code with an specific color. I changed in settings from HTML to CSS highlights but then it doesn't show HTML color codes but it finally shows up CSS highlighted colored codes. If you really didn't understand me, what I am about to say is like when <a href="Website.html" is colored with href as green colored code and the other one CSS code such as .btn, border: none; etc it doesn't have any color until I change it in the settings but later that .btn and whole CSS file have colors but HTML doesn't. If can anyone tell me if I can do something in any of these two Notepad++ or Sublime Text 3.
Sublime Text should be able to tell which syntax highlighting to use, if the file syntax is set to HTML. As long as your css is inside style tags. If it is and you're still not seeing correct highlighting, it might be an issue with your particular color scheme.

What can cause CSS to show as text on a webpage?

I'm running into a weird issue, where css code (pulled in from a .css file, NOT embedded in style tags) is showing as text on a page, and I'm not sure why. Do you know what could cause this? The css that is showing is:
background-color: #009eb4; color: white;
I checked the end of the file (Approx. 10,000 lines) and there's not CSS hanging off the end outside of a selector. I couldn't find any malformed css in the section that I edited either. The CSS shows up in the DOM as the first child of the body element.
Have you tried ctrl+f ing that line of text in your HTML? could be a stray copy and paste :)

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
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
screenshot showing what happened actually in DOM

How to change the color render setting for anchor in a css file?

I'm a server-end python programmer, and have very few knowledge about css.
Recently I was using gitbook to write our doc-sites.
Everything was OK, except when I'm using anchors in the md files.
The content wrapped in the anchor tag will be show in blue. Which isn't good.
I wanna disable this blue color rendering, then I did some search and find the page was influenced by a file named style.css.
There is only 1 extremely long line in this file. I searched blue in it, nothing.
And then I searched anchor in it. I got:
fa-anchor:before{content:"\f13d"}.
.anchor{position:absolute;top:0;bottom:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}
.anchor:focus{outline:0}
Is this fa-anchor:before{content:"\f13d"}. thing which influenced the anchored content rendering? How to disable its effect?
If it isn't, what key-word should I searching in the css file for anchored contnet rendering?
PS: In this question the anchor means syntaxs in html like <a href='#stash_save'> save </a>
#Zen fa-anchor:before{content:"\f13d"} this code means the generated icon using unicode character won't be part of DOM.
By default when <a>element apply by default color turns into blue color you have to find the class if any applied on <a> tag. otherwise you can change the color using <a href="#" style="color:#535353">. using inline CSS here just for reference.
You can make a specific class for <a> tag.
Hope it solve your problem. check the DEMO also.
add color: red;
to the end of
.anchor{position:absolute;top:0;bottom:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}
and see if it modifies the color.

Sublime Text2 Bracket Highlighter , highlight a html TAG

I need to edit the plugin brackethighlighter to achieve following jpeg's effect.
on a html tag, like P,div,span tag and etc.
But my current setting had set the tag to highlight, but its still appear dotted line like the 3rd images, and i also already set the
and this is the setting on my theme
But i still get following dotted line.
if you have Djaneiro installed then you have to change the filetype to HTML from HTML Djaneiro.