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

CSS

How to make things have buttons?

Like my header or something?

If 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.

7 Answers

If 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.

/padding?

What do you mean by "have buttons"?

oops i meant how to have padding around it ?

James Bryer -

An 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.

ahhh ok, but what i mean by padding is like making my text appear within a coloured box for visual effect?

We are going to need an example here

Like the "browse our cupcakes" button but not making it a button. I just want the borders?

http://www.smellslikebakin.com

Like the "browse our cupcakes" button but not making it a button. I just want the borders?

http://www.smellslikebakin.com

You mean like an ellipse in CSS?

http://codepen.io/jamesbarnett/pen/ipCoa