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 trialJesse Sawyer
Full Stack JavaScript Techdegree Student 13,227 PointsHow to move a <p> tag to the very top of a page. Very very top.
I'm trying to move the <p> tag to the very very top of the page. Does anyone have any suggestions.
1 Answer
Hanna Mchatton
10,279 PointsThere are a few ways of doing this depending on your markup and desired effect. Do you want it to remain at the top as in a fixed position? Is it a direct child of the body element, then you can use position: relative? Could you please post your markup and CSS, as well as a longer description of what behavior you would like your <p> element to have? This way we can know whether you need flex-box or CSS-grid and can give you the best solution.
Jesse Sawyer
Full Stack JavaScript Techdegree Student 13,227 PointsJesse Sawyer
Full Stack JavaScript Techdegree Student 13,227 PointsHere's the HTML.
</head> <body>
<!--Header Section--> <header> <div id="info"> <ul> <li>416-999-9999</li> <li>4 Coxwell Avenue Toronto, ON M4l 3A7</li> <li>Follow Us On Social Media!</li> </ul>
</div>
Here is the CSS
body{ font: 15px/1.5 Arial; padding: 0%; margin: 0%; }
.container{ width:80%; margin:auto; overflow:hidden; }
/* header */ header{ background:black; border-bottom: white; padding-top: 5px; min-height: 70px; }
info{
color: white; margin: 0 auto; padding: 10px; text-align: center; }
info li{
display: inline; padding: 111px; font-family: Arial, Helvetica, sans-serif; }
info ul{
border: none; }
name h1{
text-align: center; color:white; margin-top: 0px; padding: 0; }
header a{ color: white; text-decoration: none; text-transform: uppercase; font-size: 15px; }
header li{ display: inline; padding: 20px 20px; }
header ul{ border-bottom: 2px solid silver; padding-bottom: 10px; }
header nav{ text-align: center; border-bottom: 10px; height: 50px; }
I ended up changing everything around by creating a second list and making it inline. I wanted to post some information like phone number, address and social media icons above the h1 tag. Let me know if I should do something else.