div covers the whole width even though i limit the width | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

div covers the whole width even though i limit the width

Hey guys I am trying to create sandwich menu button. I created the button and acheived what i needed to make but when i make the div a link the whole 100% width becomes a link how can i stop the div from covering the whole width? NOTE: I have added background color to highlight the background area thats covering the whole background witdh _____:HTML CODE:____ <!DOCTYPE> <html> <head> <title>image hosting</title> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <nav class="nav"> <a href="index.html"> <div></div> <div></div> <div></div> </a> </nav> </body> </html> _________________________ _____:STYLESHEET:________ body { margin: 0px; padding: 0px; border-style: none; } .sand { width: 40px; max-width: 40px; min-width: 35p; position: relative; } div { height: 7px; background-color:orange; width:35px; margin-top: 3px; padding: 1px; border-radius: 90px; } a { width: 40px; white-space: nowrap; } .nav { background-color: khaki; } _______________________________________________________

2nd Dec 2017, 10:00 AM
Muhammed Hussain
Muhammed Hussain - avatar
2 Answers
0
There is no problem with the code but please use code playground next time so that it is easier for us to identify the problem.
2nd Dec 2017, 4:59 PM
DAB
DAB - avatar
0
I have created this code in code playground. how can i link it here ?
2nd Dec 2017, 8:31 PM
Muhammed Hussain
Muhammed Hussain - avatar