title: How to place a text inside the top-left corner border of div
body: <p>I've been going through lot of articles about placing a label/legend/text on the border of a div. I've a lot of div where I want to show the different labels exactly like the image shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/TTBSW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TTBSW.jpg" alt="enter image description here"></a></p>
  
  <p>As I can see in the w3school they say to have a field set and get declare legend to display the texts, but its not working out for me. I have a set of jquery codes which appends the html with the labels :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.menu').hover(function () {
    $(this).css('border', 'solid 2px #8080ff');
    $(this).find('.divlabel').show();
  }, function () {
    $(this).css('border', 'none');
    $(this).find('.divlabel').hide();
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.divlabel {
    float: left;
    top: 5px;
    right: 10px;
    padding: 0px;
    background: #fff;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="menu"&gt;
    &lt;div class="divlabel"&gt;Menu&lt;/div&gt;
    &lt;ul class="mainmenu"&gt;
      &lt;li&gt;...&lt;/li&gt;
      &lt;li&gt;...&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Its not working as desired, please help out guys with this css.</p>