简体   繁体   中英

Is there another kind of button in html?

I'm a beginner in html's world. I'm playing this game: https://dragonbound.net I'd enter to the "shop". and I'm wondering me about the html code of this. So I went to "inspect element" of the web and I realized that there is no form or href in the buttons. How these buttons works and Why I can access to the container of the middle that has the items? For example, this is one of the "buttons"

 #buttonShopEyes { left: 407px; top: 495px; width: 33px; height: 31px; background-position: -72px -204px; } 
 <div id="buttonShopEyes" class="opacity_button NoSelect shopButton"><div class="Alt" style="display: none;">G</div></div> 

When i go to the source, i can see:

 <div id="buttonShopEyes" class="opacity_button NoSelect shopButton"><div class="Alt">G</div></div> 

Many HTML elements can behavior like buttons. For instance: a, divs, spans, p, etc. However, if you want to develop a consistent code, you should pay attention to the semantic. If you need a button, create a button element. You can change all style properties for the button if you want. If you create a <a href="someplace">Some place</a> element, you should redirect the user to another place, (ie another page, or another anchor, in the same page). Avoid using <a href="javascript:void(null)"> or <a href="#"> , instead, use a button in that cases.

HTML is free to use of many ways, you should be aware of the best practices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM