Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jim McQuarrie
10,597 Pointstrying to get a button to work
Am am using some jquery and trying to center a button with no avail because there is no button class in the css. any ideas? the code is below: Here is a quick video which I believe will explain the best way possible. Just a couple minutes long. http://www.screencast.com/t/z5npUv9BO
//1, Hide courses
$(".courses section").hide();
//2, Add a button
$(".courses").append("<button>Click Here to Reveal My
Courses</button>");
//3, When button pressed
$("button").click(function(){
//3.1, Show courses next to the button clicked
$("section").slideDown().show();
//3.2, Get rid of button
$(this).remove();
});
Here is the css
text-decoration:none;
display:inline-block;
text-shadow: -1px -1px 0 rgba(0,0,0,0.3);
font-weight:bold; color: #FFFFFF;
background-color: #3093c7;
Jim
1 Answer
Steven Bister
12,011 PointsHey man, have you tried setting your left and right margins for your button to auto?
So like this margin: 50px auto 0;
You may also need to change the display to block rather than inline-block
Hope that helps!