CSS Alignment Question

  • kentga
  • Newbie
  • Newbie
  • kentga
  • Posts: 9

Post 3+ Months Ago

First all I want to thank those who have responded to my questions

I have got most things I have tried to work in CSS but I cannot get my elements here to line up correctly. There is a space between my titlepic and my (h1) headline and I want the h1 right below it with no spaces


Code: [ Select ]
<style type="text/css">
body {background-color: blue;}
titlepic {
position: relative;
top: 1px;
left: 1px;
}
h1 {
  position: relative;
  top: 0px;
  left: 2px;
  text-align: center;
  color: white;
  background-color: #1078E1;
  font-family: Helvetica, Geneva, Arial,
     SunSans-Regular, sans-serif
  }
</style>
</head>
<body>
<img src="pics/title1.jpg" alt="power4sports" id="titlepic" />
<h1>Power4sports </h1>
</body>
</html>
  1. <style type="text/css">
  2. body {background-color: blue;}
  3. titlepic {
  4. position: relative;
  5. top: 1px;
  6. left: 1px;
  7. }
  8. h1 {
  9.   position: relative;
  10.   top: 0px;
  11.   left: 2px;
  12.   text-align: center;
  13.   color: white;
  14.   background-color: #1078E1;
  15.   font-family: Helvetica, Geneva, Arial,
  16.      SunSans-Regular, sans-serif
  17.   }
  18. </style>
  19. </head>
  20. <body>
  21. <img src="pics/title1.jpg" alt="power4sports" id="titlepic" />
  22. <h1>Power4sports </h1>
  23. </body>
  24. </html>


Thx

Kent
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Try adding "margin-bottom:0px;" to titlepic and "margin-top:0px;" to h1. Is all of the relative positioning really necessary for such a simplistic layout?
  • kentga
  • Newbie
  • Newbie
  • kentga
  • Posts: 9

Post 3+ Months Ago

Thx

I do not know

How would you reccomend I do it

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 50 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.