SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Figuring out positioning

    I'm having a little trouble with my layout. My idea is to have a block of text framed by some images. There are three images. A left frame, a right frame, and a center frame. The left and right images are actually shaped like frames so my thought was to position them absolutely so that I could get them to frame the text how I wanted it. Of course...when I previewed this and changed the window size everything looked completely wrong. Here's some of the code I'm using. I'm not sure the best way to wrap things/the correct css to use to get it to do what I want.

    Code:
    <div id="bordercontain"><img src="images/leftgaze.png" class="leftimage" /><img src="images/gazebocenter.png" class="centerimage" />
        <img src="images/rightgaze.png" class="rightimg" />
        <div id="mainContent">
          <h1> Main Content </h1>
          <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. </p>
        </div>
      </div>

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2008
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi .. make it by table ..

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought the idea was to move away from tables? I'm new to this so I'm not quite sure how a table would be appropriate seeing as I need things to be overlapping.

  4. #4
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would use floats for this. Do you have a picture of how you would like it?

  5. #5
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suppose I'd like it to look something like this: dubbyadubbyadubbya.duke.edu/~jec23/sample.JPG

    Basically those images framing something. It may be a div with some text in it, or the rest of my site. Basically I need those two images to frame a div.

    Edit: Hopefully you figured out my link haha, doesn't want me to post them.

  6. #6
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://frederikvig.com/temp/test.htm
    Basicly I used two background images and the sliding door technique.
    Hopefully this illustrates one approach you can take.

  7. #7
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That looks pretty good. Looking at the source:
    Code:
     #bordercontain 
        { 
            background: url(left.png) no-repeat left top;
            width: 600px;
            
        }
        #mainContent 
        {
            background: url(right.png) no-repeat right top;
            padding: 100px 60px 5px;
        }
    You put the two images in different div tags. One is in the outside of the main content and one is where the main content is. I'd like to keep the images outside of the div for neatness if possible. Also if I had an image I wanted to put, lets say in the middle of those two frames, where would that one go? I'm going to look into this sliding door technique

  8. #8
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jcafaro10 View Post
    You put the two images in different div tags. One is in the outside of the main content and one is where the main content is.
    Yes, the reason for that is that currently you can only have one background image per element.
    Quote Originally Posted by jcafaro10 View Post
    I'd like to keep the images outside of the div for neatness if possible.
    Not sure want you mean. Like <img src="left.png" /> etc? This would not be possible because of the text overlapping the image.
    Quote Originally Posted by jcafaro10 View Post
    Also if I had an image I wanted to put, lets say in the middle of those two frames, where would that one go? I'm going to look into this sliding door technique
    Depends on the image, if its a background image you could either use the h1-tag or the p. But changes requires that you take another look at the current solution and perhaps change it (move the background images to different elements etc).

  9. #9
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm having some trouble getting both images to show up. Here's my code. The image in main content shows up. The one for border contain does not

    Code:
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css"> 
    <!-- 
    body  {
    	font: 100&#37; Verdana, Arial, Helvetica, sans-serif;
    	background: #666666;
    	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    	padding: 0;
    	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    	color: #000000;
    }
    .twoColFixLt #container { 
    	width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
    	background: #FFFFFF;
    	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    	border: 1px solid #000000;
    	text-align: left; /* this overrides the text-align: center on the body element. */
    }
    .twoColFixLt #sidebar1 {
    	float: left; /* since this element is floated, a width must be given */
    	width: 200px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
    	background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */
    	padding: 15px 10px 15px 20px;
    }
    .twoColFixLt #mainContent { 
    	margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
    	background-image: url(images/rightgaze.png);
    	background-repeat: no-repeat;
    	background-position: right top;
    	padding: 0 20px 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
    } 
    
    
    
    
    .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    	float: right;
    	margin-left: 8px;
    }
    .fltlft { /* this class can be used to float an element left in your page */
    	float: left;
    	margin-right: 8px;
    }
    .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    	clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    }
    #bordercontain {
    	background-image: url(images/leftgaze.png);
    	background-repeat: no-repeat;
    	background-position: left top;
    }
    --> 
    </style>
    <!--[if IE 5]>
    <style type="text/css"> 
    /* place css box model fixes for IE 5* in this conditional comment */
    .twoColFixLt #sidebar1 { width: 230px; }
    </style>
    <![endif]--><!--[if IE]>
    <style type="text/css"> 
    /* place css fixes for all versions of IE in this conditional comment */
    .twoColFixLt #sidebar1 { padding-top: 30px; }
    .twoColFixLt #mainContent { zoom: 1; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]--></head>
    
    <body class="twoColFixLt">
    
    <div id="container">
      <div id="sidebar1">
        <h3>Sidebar1 Content</h3>
        <p>The background color on this div will only show for the length of the content. If you'd like a dividing line instead, place a border on the left side of the #mainContent div if it will always contain more content. </p>
        <p>Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque  eget, cursus et, fermentum ut, sapien. Fusce metus mi, eleifend  sollicitudin, molestie id, varius et, nibh. Donec nec libero.</p>
      <!-- end #sidebar1 --></div>
      
      <div id="bordercontain">
        <div id="mainContent">
          <h1> Main Content </h1>
          <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce  varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id,  libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat  feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut,  sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh.  Donec nec libero.</p>
          <h2>H2 level heading </h2>
          <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p>
    	  <!-- end #mainContent -->
        </div>
      </div>
      <!-- end #bordercontain -->
      <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
      <br class="clearfloat" />
    <!-- end #container --></div>
    </body>
    </html>

  10. #10
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is because it is behind #sidebar1.
    By the way you should download firebug, it's a great addon for firefox that lets you inspect the webpage, edit it, monitor the css, html and javascript and more .

  11. #11
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see now. Thanks! I've been using dreamweaver actually.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •