Closing div tag placment

Should the div tag be at the end of the a anchor tag, or at the end of the entire code?

<div class="linkse">
</div>

1

<div class="wrape">
  <div class="covere" title="OPEN"></div>

  <div class="linkse">
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a> Audio Player</a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="http://hi5.1980s.fm/played.html" target="_blank" title="Song History">
      <div class="left-background"></div>
      <div class="left-border"></div>
      <div class="middle-background"></div>
      <div class="right-border"></div>
      <div class="right-background"></div>
    </a>

</div>

    <div class="playButtone" data-audio="http://hi5.1980s.fm/;">

      <svg class="playe hide" focusable="false" width="38" height="40" viewbox="0 0 85 100">
        <path d="M81 44.6c5 3 5 7.8 0 10.8L9 98.7c-5 3-9 .7-9-5V6.3c0-5.7 4-8 9-5l72 43.3z">
        </path>
      </svg>

      <svg class="pausee hide" focusable="false" width="36" height="40" viewbox="0 0 60 100">
        <path d="M0 8c0-5 3-8 8-8s9 3 9 8v84c0 5-4 8-9 8s-8-3-8-8V8zm43 0c0-5 3-8 8-8s8 3 8 8v84c0 5-3 8-8 8s-8-3-8-8V8z">
        </path>
      </svg>
    </div>
  </div>
</div>

or

2

<div class="wrape">
  <div class="covere" title="OPEN"></div>

  <div class="linkse">
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a> Audio Player</a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="http://hi5.1980s.fm/played.html" target="_blank" title="Song History">
      <div class="left-background"></div>
      <div class="left-border"></div>
      <div class="middle-background"></div>
      <div class="right-border"></div>
      <div class="right-background"></div>
    </a>

    <div class="playButtone" data-audio="http://hi5.1980s.fm/;">

      <svg class="playe hide" focusable="false" width="38" height="40" viewbox="0 0 85 100">
        <path d="M81 44.6c5 3 5 7.8 0 10.8L9 98.7c-5 3-9 .7-9-5V6.3c0-5.7 4-8 9-5l72 43.3z">
        </path>
      </svg>

      <svg class="pausee hide" focusable="false" width="36" height="40" viewbox="0 0 60 100">
        <path d="M0 8c0-5 3-8 8-8s9 3 9 8v84c0 5-4 8-9 8s-8-3-8-8V8zm43 0c0-5 3-8 8-8s8 3 8 8v84c0 5-3 8-8 8s-8-3-8-8V8z">
        </path>
      </svg>
    </div>
  </div>
</div>

The 2nd one, at the end of the code.

In the 1st, the class “linkse” doesn’t get completed with a div tag, while it’s parent class “wrape”, does.

The 2nd one has the other elements nested within, while taking care of the closing tags at the bottom.

I don’t agree for some reason, so I’m going to wait for a second opinion.

Should this closing div tag be at the end of the a anchor tag,

<div class="nav">
</div>
  <div class="nav">
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a class="ap"> Audio Player</a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a class="sh" href="http://hi5.1980s.fm/played.html" target="_blank" title="Song History">
      <div class="left-background"></div>
      <div class="left-border"></div>
      <div class="middle-background"></div>
      <div class="right-border"></div>
      <div class="right-background"></div>
    </a>
  </div>

or at the end of the entire code?

      </svg>
    </div>
  </div>
</div>
<div class="wrap">
  <div class="cover" title="OPEN"></div>
  <div class="nav">
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a class="ap"> Audio Player</a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a href="" target="_blank" title=""></a>
    <a class="sh" href="http://hi5.1980s.fm/played.html" target="_blank" title="Song History">
      <div class="left-background"></div>
      <div class="left-border"></div>
      <div class="middle-background"></div>
      <div class="right-border"></div>
      <div class="right-background"></div>
    </a>


  <div class="playButtone" data-audio="http://hi5.1980s.fm/;">

    <svg class="playe hide" focusable="false" width="38" height="40" viewbox="0 0 85 100">
      <path d="M81 44.6c5 3 5 7.8 0 10.8L9 98.7c-5 3-9 .7-9-5V6.3c0-5.7 4-8 9-5l72 43.3z">
      </path>
    </svg>

    <svg class="pausee hide" focusable="false" width="36" height="40" viewbox="0 0 60 100">
      <path d="M0 8c0-5 3-8 8-8s9 3 9 8v84c0 5-4 8-9 8s-8-3-8-8V8zm43 0c0-5 3-8 8-8s8 3 8 8v84c0 5-3 8-8 8s-8-3-8-8V8z">
      </path>
    </svg>
  </div>
</div>
</div>

As mentioned before; cut and paste the script into W3.org Free Validation utilities.

Errors and warnings are shown. You can then find the offending lines, edit online until the script validates.

I am still amazed about your insistence to use jsFiddle as a development tool. As far as I am concerned JsFiddle is to demonstrate fully functional working scripts and not for debugging.

Edit:
Here are the W3.Org Free Validation Tools to save having to look:

https://validator.w3.org


http://jigsaw.w3.org/css-validator/

1 Like

Did you check your CSS scripts?

Next step is to search for a FREE Web Site Hosing Plan and create test web pages. The test web page URLs can then be pasted into the W2,Org Validation Tools.

It is far easier to develop sites using this method because the test web pages will be the actual web pages rather than using JsFiddle Snippets.

What might work on JsFiddle may conflict with additional web page scripting.

That has nothing to do with my question on here. I didn’t mention the CSS at all.

True.

The HTML script may validate OK but it takes CSS to render correctly

The JsFiddle Script uses CSS.

? What is the difference between

<div class="wrap"> 
  <div class="cover"></div> 
  <div class="links">...</div> 
  <div class="playButton">...</div> 
</div>

and

<div class="wrap"> 
  <div class="cover"></div> 
  <div class="links">
  ...
    <div class="playButton">...</div> 
  </div>
</div>

Specifically, is the playButton div content a child of the wrap div, or a child of the links div?

1 Like

I have no idea.

I would need to figure out, how I would find this out.

If you’d used a ul and list structure for the anchors as you were told to do then the semantic placement of the tags becomes obvious.

Congratulations on your worst code so far. We obviously have been unsuccessful in educating you towards semantic html. :slight_smile:

3 Likes

You don’t put the ul all the way at the end of the entire code, you put it at the end of the a anchor tag.


        </div>
      </a>
    </li>
  </ul>

A div would work the same way.

This is what I first thought.

The wrap is what goes around the entire code, the links need to be enclosed themselves by the div tag.

  <div class="linkse">
    <a href="" target="_blank" title=""></a>
    </a>
</div>
1 Like

You could think of a child element as “belonging” to its parent element.

As an analogy, say you have a sister and a father. Would it be more correct to say you and your sister are siblings that belong to your common father, or that you are your father’s child and your sister is your child? If say you have a father and a daughter, would it be more correct to say you and your daughter have a common father?

In other words, it all depends on the relationship. And that depends on what the content is and what you as the designer think would be the best way to organize the content.

As you are aware, there can be many ways to do similar things and any two designers could decide to do it differently.

For example, this forum has a row for each post. A row has a div for the avatar and a sibling div for the post. It could have just as easily had the avatar in the same div as the post. Why wasn’t it? Designers preference.

3 Likes

I have made repeated efforts to explain to you the difference between adjacent and nested elements, and the placement of closing tags. Copy this code into an HTML document and open it in your browser. Play with it. Add extra divs, until you are sure you understand how it works. This is fundamental to HTML.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Nested and Adjacent Divs</title>

<style>

div {margin: 1em;
	padding: 1em;
	}
	
.first {border: 2px solid green;}	

.second {border: 2px dotted blue;}

</style>

</head>
<body>

<div class="first">These divs are siblings; they are adjacent to each other.</div>
<div class="second">These divs are siblings; they are adjacent to each other.</div>

<div class="first">
These divs are nested.  This is the parent.
   <div class="second">
   These divs are nested.  This is the child.
   </div>
</div>

</body>
</html>
5 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.