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

HTML

Bootstrap - Vertical Centering

I am trying to just code up a simple index, but I can't figure out how to move my button down the page so that it is even with my img. I am using Bootstrap 3.0.2 and don't have any stylesheet linked. http://pastie.org/8476036 My Screen: http://imgur.com/J9UkIPp

2 Answers

You have the in the <button> tag where the classes are defined you should add a column class that way the button is in a column right beside the image.

I'm sorry, I don't exactly understand what you mean.

Ok so you have.

<img class="col-lg-5 img-responsive" src="img/life.gif">
<p class="col-md-2 col-md-offset-3"><button type="button" class="btn btn-default">Default button</button></p>

Well I would try doing something like this: <img class="col-lg-5 img-responsive" src="img/life.gif"> <button type="button" class="btn btn-defaul col-lg-2">Default button</button>

Then offset it until it looks good. Rather than putting it inside a paragraph tag which isn't needed just add those classes to the button and see if it works.

It's being dumb and won't let me edit my post but here.

Code: <img class="col-lg-5 img-responsive" src="img/life.gif"> <button type="button" class="btn btn-default col-lg-2">Default button</button>

You have to be kidding it won't post the code. It keeps giving the default button thing. Take the paragraph tags away from the button and in the <button> tag add the col-lg-2 to the class after btn-default.

Pastie.org perhaps?

Ok try this code. http://pastie.org/8476094

I erased my old code, and put that in under the #content1. That made the button in the middle to the screen, so that's good. But can you think of a way to vertically align the button now so that it is even to the center of the image?

Can you upload your source files somewhere for me and I can look at it when I get extra time.

Thank you for your help!

Ok not really a great way to do it but it works, I went into your style.css and added this code.

.btn {
margin-top: 11.5em
}

See and I was thinking the same thing. The problem is that when the screen width changes it goes to the bottom left. I don't know how to workaround this problem.

Thank you for your help first off. However, I can see the first code, mine, but I cannot see your code. All it says is "Well I would try doing something like this: Default button"