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
Justin Hein
14,811 PointsBootstrap - 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
Casey Clayton
16,708 PointsYou 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.
Justin Hein
14,811 PointsThank 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"
Justin Hein
14,811 PointsJustin Hein
14,811 PointsI'm sorry, I don't exactly understand what you mean.
Casey Clayton
16,708 PointsCasey Clayton
16,708 PointsOk so you have.
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.
Casey Clayton
16,708 PointsCasey Clayton
16,708 PointsIt'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>
Casey Clayton
16,708 PointsCasey Clayton
16,708 PointsYou 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.
Justin Hein
14,811 PointsJustin Hein
14,811 PointsPastie.org perhaps?
Casey Clayton
16,708 PointsCasey Clayton
16,708 PointsOk try this code. http://pastie.org/8476094
Justin Hein
14,811 PointsJustin Hein
14,811 PointsI 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?
Casey Clayton
16,708 PointsCasey Clayton
16,708 PointsCan you upload your source files somewhere for me and I can look at it when I get extra time.
Justin Hein
14,811 PointsJustin Hein
14,811 Pointshttps://www.dropbox.com/s/isbq60rmx5hdoeg/dist.zip
Justin Hein
14,811 PointsJustin Hein
14,811 PointsThank you for your help!
Casey Clayton
16,708 PointsCasey Clayton
16,708 PointsOk not really a great way to do it but it works, I went into your style.css and added this code.
Justin Hein
14,811 PointsJustin Hein
14,811 PointsSee 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.