Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CSS help, PLEASE.
#1
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>
#2
Did you use the W3C validator to make sure your code is correct?
Superman I am here to rescue you.
This is Support Forums not Support PMs.  Do not PM me for support unless it's private and site related.
#3
position attribute may be the answer.
position:relative; or position:absolute;

also instead of margins I would say use top: and left:
#4
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.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Free Worker HTML, CSS, Javascript ImFocuzz 2 1,101 04-05-2014, 10:01 PM
Last Post: VHPanda
  Forum CSS code problem. inferno.lion 0 664 06-10-2013, 02:48 AM
Last Post: inferno.lion
  MyBB CSS Postbit Buttons Peter L 1 1,312 07-14-2012, 05:52 PM
Last Post: 'Snorlax
  inline css question andrewjs18 1 882 03-24-2012, 10:11 AM
Last Post: Haxalot
  Need a CSS Teacher! ImFocuzz 2 952 03-08-2012, 06:01 PM
Last Post: BreShiE

Forum Jump:


Users browsing this thread: 1 Guest(s)