user5419187
user5419187

Reputation:

Structure tags and text inside button

I would like to know how should I structure html in the example above:

1-)

 <h1>My Title</h1>
    <a href="#">My
     <span class="hide">Button</span>
    </a>

2-)

 <h1>My Title</h1>
    <a href="#">
      <span>My<span>
      <span class="hide">Button</span>
    </a>

I have this doubt, if I should put the My inside a span tag too.

Upvotes: 1

Views: 78

Answers (2)

srikanth r
srikanth r

Reputation: 332

div is a block level,means on its own separate line.where as is of type inline.and is an tag to define hyperlink

where div is used to wrap large part of information and span is used for smaller part of information/Text and "a" for hyper link. For more information refer following Html Working Draft

And in your code :-

     <h1>My Title</h1>
<a href="#">
  <span>My</span>
  <span class="hide">Button</span>
</a>

make this change .

Upvotes: 0

Lemon Kazi
Lemon Kazi

Reputation: 3311

Without span tag it will work.

<h1>My Title</h1>
<a href="#">My
 <span class="hide">Button</span>
</a>

If you want you can place span tag. But no need for that. You forgot to close <span> tag in your 2nd html code for my.

<h1>My Title</h1>
<a href="#">
  <span>My</span>
  <span class="hide">Button</span>
</a>

Upvotes: 1

Related Questions