Support Forums
CSS help, PLEASE. - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Webmaster Support (https://www.supportforums.net/forumdisplay.php?fid=36)
+---- Forum: Website Development (https://www.supportforums.net/forumdisplay.php?fid=43)
+---- Thread: CSS help, PLEASE. (/showthread.php?tid=3416)



CSS help, PLEASE. - Elektrisk - 12-08-2009

This is seriously fuckin|g my brains!
I simply want to create a <div> to create a right sidebar. Whenever I set the margins to position it to the right of .mainContent (where lorem ipsum is), it always affects the mainContent <div>. HOW on earth can I set it so it doesn't effect the maincontent <div>. Here's a screenshot. I'd like a <div> to the RIGHT of maincontent, to create a sidebar affect. Here's the entire coding. I'm a total beginner, so if it looks jumbled, forgive me.

http://i46.tinypic.com/14ub7d5.jpg

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.mainContent {
    font-family: Verdana, Geneva, sans-serif;
    color: #000;
    width: 70%;
    height: 50%;
    text-align: justify;
    clear: both;
    margin-bottom: 200px;
}
#nav-menu ul a:link {
    text-decoration: none;
    color: ;
}
a:visited {
    text-decoration: none;
    color: #F0C;
}

body {
background-image: url(_images/opaque.jpg)
}


#nav-menu ul a:hover {
    color: #36F;
}

#nav-menu ul
{
    list-style: none;
    padding: 0;
    margin: 0;
    text-decoration: none;
    margin-left: 200px;
}
#nav-menu li
{
    float: left;
    margin: 0 1em;
    font-size: 1em;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    left-marin: 50px;
}


.footer {
    margin-top: 150px;
    text-align: center;
}
-->
</style>
</head>

<body>
<div id="nav-menu">
  <ul>
    <li><a href="#">XXX</a></li>
    <li><a href="#">XXX</a></li>
    <li><a href="#">XXX</a></li>
    <li><a href="#">XXX</a></li>
    <li><a href="#">XXX</a></li>
    <li></li>
  </ul>
</div>
<br />
<div class="mainContent">
  <p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore  Content for  class "footer" Goes Here veritatis et quasi architecto beatae vitae dicta <img src="_images/ripped1.jpg" width="331" height="241" align="right" /> sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
</div>
<div class="footer">
  <p>Copyright (c) 2009-2010 Harvard Consulting</p>
</div>
</body>
</html>



RE: CSS help, PLEASE. - Omniscient - 12-08-2009

Did you use the W3C validator to make sure your code is correct?


RE: CSS help, PLEASE. - Gaijin - 12-08-2009

position attribute may be the answer.
position:relative; or position:absolute;

also instead of margins I would say use top: and left:


RE: CSS help, PLEASE. - Elektrisk - 12-08-2009

Quote: Did you use the W3C validator to make sure your code is correct?

I just did. The only error found was that I didn't specify the alt attribute in the img tag, which I doubt is related to my issue.

@NinjaGeek,
Thanks! Using position: absolute and using top/left worked. You're a lifesaver.
Looks like I have a lot more to learn Big Grin

This thread can be closed.