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 trialDaniel Popescu
1,556 PointsCentered
I am trying to put my text and the images in the center of the page just like in the video "Working with Grids" and it doesn't work. I am using the same code as in the video <body> <div class="container"> </div> </body>. I also have placed the link in the "head" tag for the grid: <link rel="stylesheet" href="css/grid.css" type="text.css" media="screen>. And also I indented my text. Can anyone tell me what I did wrong?
12 Answers
Daniel Popescu
1,556 PointsGuys, I used inside the div putting style too, text-align: center and it works. Thank you for your support. I learned some stuff!
Mamal Khan
14,206 Pointsuse a site like codepen.io to show your work... then we will help you.
Erik Montes
3,717 PointsAre you using the
text-align: center
property for it?
Daniel Popescu
1,556 PointsI put code in my video also, but it went away.
Daniel Popescu
1,556 Pointshttps://gist.github.com/anonymous/7518200
There is a link to my work, it's the html and the grid.css. I also have the normalize.css bu I saw there is only one section to put a css file so I put just the grid. No I haven't used the text-align: center. How can I display what I do just like you did Erik Montes?
Erik Montes
3,717 PointsFirst of all, your html format is not correct. In your gist you have the img tag in the head, which should be in the body. Also the media attribute value needs quotes on both sides not just one:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<img src="img/logo.gif" alt="Logo"><!-- Needs to go in the body, not here in head -->
<link rel="stylesheet" href="css/normalize.css" type="text.css" media="screen><!-- needs to be "screen" not "screen -->
<link rel="stylesheet" href="css/grid.css" type="text.css" media="screen> <!-- also needs to be "screen" not "screen -->
</head>
A lot of the times having improper HTML tags and such will cause things to act weird. So try fixing that just to make sure that's not the culprit.
Mamal Khan
14,206 PointsI've added the answer to your gist:
- you haven't closed your media attribute's value
- you've used a wrong type attribute in them, too.
try them out and center your text. There is another centering which contains adding margin of 0 & auto to a well-defined width of container.
Daniel Popescu
1,556 PointsI closed my media attribute, still doesn't work.
"also we have a tag and a tag. don't include an in ... It's apples and oranges. ;)"
what's an in?
And also is it wrong to use to .css files? It's as directed by treehouse..
Mamal Khan
14,206 PointsI forgot to add Markdown style!
Now It's fixed!
Daniel Popescu
1,556 PointsHow do I add markdown style?
James Barnett
39,199 PointsCheck out this thread on how to type code in the forum for some examples.
Mamal Khan
14,206 Pointsin githubt go here
and for Treehouse just click Markdown Cheetsheet
Mamal Khan
14,206 Pointshappy to hear that. ;)