Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you some how add a class to a </div> tag specify what div ends there?

Tags:

html

Like if I had:

<div class="body">

<div class="logo">
<img...>
</div>

<p>some text</p>
</div>

Could I go...

<div class="body">

<div class="logo">
<img...>
</div class="logo">

<p>some text</p>
</div>

...so that it knows to end the second div and not the first?(this is a light example of what I am trying to do, but I think you get it)

(and if it is possible, a way using just HTML or css)

like image 907
PG55 Avatar asked Mar 12 '23 03:03

PG55


2 Answers

If your motive is to identify the closing tag effectively means, possibly you can use the comments

<div class="body">

<div class="logo">
<img...>
</div> <!-- logo div closed here -->

<p>some text</p>
</div>

Proper formatted code will help to find the closing tag hierarchy.

like image 137
Pandiyan Cool Avatar answered Apr 27 '23 01:04

Pandiyan Cool


Nope.

Closing tags always close the most recently opened matching tag. In your example, it simply works as desired. And the alternative would not be valid markup: tags cannot overlap.

like image 31
svidgen Avatar answered Apr 27 '23 00:04

svidgen