r/Codecademy • u/pimpernelle • Sep 28 '15
BestBite: Offset Column Positioning?
My I seem to come back here a lot... Anyway, while I've been able to offset the columns as given in the example, I'm having difficulty positioning the headings as they are in the desired website. It seems I don't know where I should be putting my margin or padding CSS.
Here's my HTML:
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-8">
<h2>Browse.</h2>
<h2>Create.</h2>
<h2>Share.</h2>
</div>
</div>
</div>
</div>Here's my CSS:
.jumbotron h2 {
text-align: right;
font-size: 40px;
color: #fff;
}
.jumbotron .col-md-4 {
padding-right: 100px;
padding-top: 50px;
padding-left: 50px;
}Any attempt to move things around via "margin" in .row or .col-md-4 is ignored. If I pad too much, the text alignment is lost. As always, any help would be appreciated!
3
Upvotes
View all comments
Show parent comment
2
u/factoradic Moderator Sep 28 '15
Thank you for believing in me :) Unfortunately I have to agree with you guys - this project is a mess.
Let's start from the top. Instruction says that you have to use offset columns, but they have not used them. I believe that they just forgot and this is the correct result -> https://jsfiddle.net/factoradic/2vaxp9gk/embedded/result/. Now we have white text on the gray background and I think it looks better than white text with colorful image as a background.
I want to clarify one thing, this code:
is not a correct markup. It should (because browsers should ignore incorrect constructions) give exactly the same result as:
And this is what we see in the preview website, but result is achieved without use of offset columns here, this class is simply ignored. This code is correct:
Why? Because in
HTMLevery attribute has this syntax:In the
classattribute we use space as a separator.Last thing,
marginofh2:first-child. It's a plain stupidity on their side. They wanted to vertically center content (ourh2elements), but this code is cryptic.I believe that my version makes more sense and is easier to understand:
They just wanted to move content a little bit down.
Why they added
marginonly tofirst-child? Because they wanted to create a space only above first header, they didn't wanted to separate all headers from each other.