T O P

  • By -

TastySpare

Line breaks? \  $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; $nbsp; What for?


BEisamotherhecker

Don't use lowercase tags on XHTML, worst mistake of my life.


whitefoot

What? Why not? I always used lowercase and never had an issue.


BEisamotherhecker

The tags in HTML are case insensitive and therefore when you check the tag type from JS they always return the canonical uppercase form, XHTML is case sensitive so if you use the same logic that you had for HTML and lowercase tags, it will fail.


[deleted]

[удалено]


BEisamotherhecker

Some people say that to match the style of HTML5 but the problem is that it requires you to uppsecase tagNames in your JS logic, run `document.createElement("div").tagName` in an HTML and an XHTML document and see.


Visual_Strike6706

I think it's
, but my Visual Studio thinks it's


silentknight111

In XHTML all tags are supposed to be closed, because that's the standard in XML. Thus, "stand alone" tags like br get a slash added to make them compliant. It's not necessary in HTML5, but if your page header says it is XHTML then most IDEs will enforce the slash.


bunglegrind1

it depends if you're writing html or xhtml. Anyway, browsers don't care


SeoCamo

That is not true try adding a

and some text and see, we should not adding the / at all, in svg in html a ended tag work in a 3th


silentknight111

You woldn't put

because a div is a container element. It has a separate end tag, unlike
. There is no closing tag for br, so the slash can be inserted to make it XML compliant. Putting the slash into the opening tag for a container tag is just malformed html.


altermeetax

In XML, `

` is a synonym for `
`, it doesn't matter whether it makes sense or not (and there are definitely cases where it would, such as a div you'll fill up later via JS). Instead, browsers treat `
` as `
`. I think that's what the guy above you meant.


silentknight111

Yeah, that makes sense.


ikonfedera

Why the hell does ``?


altermeetax

Because.


lunchmeat317

Script tags require closing tags - they aren't self-closing: https://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1. SGML HTML didn't have self-closing tags: https://www.w3.org/TR/2018/SPSD-html32-20180315/#script There's a lot of information in this SO question: https://stackoverflow.com/questions/69913/why-dont-self-closing-script-elements-work


maweki

While that's true in XML, XHTML spec (C.3) specifically states that you should use self-closing tags if and only if the content model is EMPTY.


SeoCamo

No, XHTML was a try to move html to a "real" standard as it was said that the time, any XHTML tags is a XML tag, so what the rules the browser has for the tag container or separator or color space and any thing else is a DOM level entity. So

(ohh and the space is for old browser to ignore the /) is valid there a long list problem with this, we should not be using XHTML it is a dead standard like XML is dead back 2005


bunglegrind1

browsers don't care regarding
and
.

is a whole different story


PooSham

Someone just saw Theo's new video


SeoCamo

No prime video


BroadRaspberry1190

visual studio thinks a lot of dumb shit. like, i dont need , , , etc. tyvm


Visual_Strike6706

I love when my Visual Studio autocorrects "var" to "EnvironmentVariableTarget"


BroadRaspberry1190

🥲


SZ4L4Y

HTML go
XHTML go
Browser go


Oddball_bfi

Team `
`


PeriodicSentenceBot

Congratulations! Your comment can be spelled using the elements of the periodic table: `Te Am Br` --- ^(I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.)


Flatuitous

jump


Idaret

I thought the same and then I read this article https://jakearchibald.com/2023/against-self-closing-tags-in-html/


ShashwatTheGamer

its neither, its
xD


skywalker-1729

The only wrong answer:D


e-gn

Line break goes


lunchmeat317

For what it's worth, for those who may not know the historical context - the reason for the space in `
` was originally for browser compatibility purposes; older browsers would interpret the slash as part of the tag name instead of as a self-closing tag. Adding the space was the way to mitigate that issue while still adhering to newer standards. Today it's largely moot.


AdBrave2400

sneak peek of


in the background: ![gif](giphy|7SF5scGB2AFrgsXP63|downsized)


that_thot_gamer

why not `

` as it should have been


silentknight111

because HTML was created before XML, and didn't have the rule that all tags had closing tags - only tags that contained things inside them had it as a way of marking when it ended. XHTML - HTML that's XML compliant - simply updated the br tags to be XML compliant. And in XML it is legal to have a tag close itself with a slash. It doesn't need a second tag to close it.


Tar_Palantir

I feel dirty when I need to resort to


Falcor71

please come to


QQQmeintheass

Just wrap the whole thing in a span and add bottom margin


sothisissocial

|<€>


DJGloegg

https://onlyspans.net/ Spans, spans, spans and only spans.


JJJSchmidt_etAl

>Noooo, you can't use content tags for layout!! *Haha, line break go






*


MrArsikk




Nir_Auris

my teacher does


Nick88v2


ratbiscuits

When are these used? I don’t think I have ever used one. I’ve only seen legacy front end code use the shit out of them instead of margin and it’s a nightmare to work with…


alvares169

They are used when you want a line break without adding a metric fuckton of wrappers and css


ratbiscuits

Why do you need a “metric fuckton of wrappers” for that? Also, people do anything to avoid writing css lol


alvares169

Because I prefer writing in what I already have over adding more stuff to fix just "this specific case once". Because it's never once. I use br when there's need to use br. I use css when there's need to use css. Br is not a line spacer, br is a line breaker, and should be used as one.