Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation [CSS] Two Divs together inline

    Hello codingforums community

    Well, I'm new with all those features about CSS related to divs. I've seen many tutorials about it and then I tried to make my own template but the problems came.

    - I'm trying to create 2 div tags in the same line on page but the thing is, both will hold different images like this image:


    That's what I want, but my only problem is how to make the width 100% gets until it reach to the right div position. When I do it the left div simply takes over all the line, and the right div goes to second line

    Before:


    After 100% width:

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Take a look at http://bonrouge.com/2c-hf-fluid(r).php

    PS: Don't trust the design view of DW or any other wysiwyg editotors, since they are not browsers. Instead, preview your pages two or three browsers.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, thanks.
    But I think that this problem can be fixed with javascript :\
    Gonna learn some things about it. If you guys have any other good tutorial about divs that could answer my question link to me

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello macaco,
    I'm sure it could be done with javascript but it's hardly necessary.
    Try this -
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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">
    html, body {
    	font: 100% "Comic Sans MS";
    	background: #FC6;
    }
    * {
    	margin: 0;
    	padding: 0;
    	border: 0;
    }
    #header {
    	height: 100px;
    	margin: 30px 0 200px;
    	background: #999 url(background/image1.jpg);
    	overflow: auto;
    }
    #hdr_right {
    	height: 100px;
    	width: 200px;
    	float: right;
    	background: #f00 url(background/imgage2.jpg);
    }
    </style>
    </head>
    <body>
        <div id="header">
        	<div id="hdr_right">
            	Right column text
            <!--end hdr_right--></div>
        <!--end header--></div>
    </body>
    </html>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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