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
James Bryer
656 PointsHow to make things have buttons?
Like my header or something?
7 Answers
Tom Bedford
15,645 PointsIf you have an item that you want to make into a button (e.g. a text link) you can create padding around it to enlarge it's size and give it a background colour so the clickable area is visible for people. The hover state lets you change the text/background colour for when someone puts their mouse over it.
Here is a very simple button:
HTML
<a href="http://example.com">Example Button</a>
a {
padding: 25px;
background: #ccc;
color: #000;
}
a:hover {
background: #369;
color: #fff;
}
I've put this on Codepen if you wanted to play around and change parts of it to see how it works.
This is very rudimentary but gives you the basic idea. There are other link states to consider (active, visited, focus) and if you wanted several buttons to make some navigation you'll want to have the links in a list. If you follow the HTML and CSS courses they cover all of this.
James Bryer
656 Points/padding?
Brandon Kepke
390 PointsWhat do you mean by "have buttons"?
James Bryer
656 Pointsoops i meant how to have padding around it ?
James Barnett
39,199 PointsAn easy way to think of the difference between margin and padding is that margins are used for creating space between elements, while padding is used for creating space within elements.
James Bryer
656 Pointsahhh ok, but what i mean by padding is like making my text appear within a coloured box for visual effect?
James Barnett
39,199 PointsWe are going to need an example here
James Bryer
656 PointsLike the "browse our cupcakes" button but not making it a button. I just want the borders?
James Bryer
656 PointsLike the "browse our cupcakes" button but not making it a button. I just want the borders?
James Barnett
39,199 PointsYou mean like an ellipse in CSS?
James Barnett
39,199 PointsJames Barnett
39,199 PointsIf you are still having issues, show us the code you are using. For some tips on how to do that, check out the tips for asking questions video located in the right hand sidebar.