Why can't I move buttons | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why can't I move buttons

I use div around button and give it an ID and use css to move button but it's not working. Any ideas can help

15th Oct 2022, 4:23 PM
Ryan Shorter
Ryan Shorter - avatar
13 Answers
+ 2
Css element should not have Space between type and name. Replace # a by #a.
16th Oct 2022, 6:13 AM
Roland
Roland - avatar
+ 2
Rad idea to do the classic Game Gear! I've changed some stuff, see if that helps you. https://code.sololearn.com/WQmSj9cCgUss/?ref=app
16th Oct 2022, 8:20 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Show your code please
15th Oct 2022, 5:27 PM
Roland
Roland - avatar
+ 1
Hi Ryan, to share your code, it's better to hit the plus button and attach it. Or in the top corner, there are 3 dots, hit that and choose share, then copy the link and paste it in your post. I believe your problem is the second "relative" you have. Read this and see if it helps: https://developer.mozilla.org/en-US/docs/Web/CSS/position
15th Oct 2022, 7:13 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
https://code.sololearn.com/W97pAdE63zl1/?ref=app
16th Oct 2022, 3:26 AM
Ryan Shorter
Ryan Shorter - avatar
+ 1
It was the spaces. Yeah trying make a game console with different games once get everything set up it be lots js.
16th Oct 2022, 7:57 PM
Ryan Shorter
Ryan Shorter - avatar
+ 1
Thanks everyone.
16th Oct 2022, 7:58 PM
Ryan Shorter
Ryan Shorter - avatar
+ 1
make the div relative position and the button at absolute position then the direction to be move
16th Oct 2022, 9:39 PM
Daudasaeed
Daudasaeed - avatar
+ 1
If each button will be unique, you want an id not a class. You should need to div each on, just add an id to each button. E.g. <button id="lefty">L</button>
17th Oct 2022, 7:46 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
I checked your code, you have the div with the id, not the button. That's why the colour streaks out. The background of the div is bigger than the button. I've updated mine above for you. You'll see the difference.
18th Oct 2022, 7:08 AM
Ausgrindtube
Ausgrindtube - avatar
0
In html <div id=u><button>U</button></div> in css # u {position:relative; relative left: 40px;}
15th Oct 2022, 5:43 PM
Ryan Shorter
Ryan Shorter - avatar
0
I am trying to customize buttons that will have different properties. Should I turn them into classes with dot notation or wrap in div alter by id's?
17th Oct 2022, 7:36 PM
Ryan Shorter
Ryan Shorter - avatar
0
Thank you, that's how I have it. Having a hard time with commands working to alter. Think might be because I am on the phone programming instead of pc. Like using ex. #a {background-color:rgb(20,40,50);} this would streak out sideways instead of making button a color, or if I go to do radius nothing happens.
17th Oct 2022, 9:18 PM
Ryan Shorter
Ryan Shorter - avatar