Hey guys.

I have a code that i'm trying to build with 2 nested divs that i want to align beside each other. i'm not sure if the below is the best way to go about it but it's the only way i could think of. only thing is that the div always just ends up under the one above it (in the nest).

So please, any guidance is UBER-appreciated.

Thanx
(i don't mind... let me know what i'm doing wrong.)

<div id="main" style="width: 1265px; height: 560px; overflow: auto;"> <!-- Middle -->
    <div id="leftmain" align="left" style="width: 705px; height: 560px; ">
        <table>
            <tr id="row">
                <td>
                    <img src="church.jpg" /></td>
                <td>
                    <img src="church.jpg" /></td>
                <td>
                    <img src="church.jpg" /></td>
             </tr>
        </table>
    </div>

	<div id="rightmain" align="right" style="width: 560px; height: 560px; ">
        <table>
            <tr id="row">
                <td>
                    1<img src="1.jpg" /></td>
                <td>
                    2<img src="2.jpg" /></td>
                <td>
                    3<img src="3.jpg" /></td>
                
            </tr>
        </table>
    </div>
	
	
	    <script type="text/javascript">
     var td = row.firstChild;
     function animate() {

         someID.scrollLeft = td.offsetLeft;
         if (td == row.lastChild)
             td = row.firstChild;
             else
                 td = td.nextSibling;
             setTimeout("animate()", 8000);
         }
         animate();
    </script>
	
</div>

Recommended Answers

All 2 Replies

By default, divs are block level elements, and won't allow other elements to lay next to them. You can fix this by setting the inner divs style to either float:left and float:right, or you can use display:inline for both. If you use display:inline, make sure that the sum of the width of your inner divs is slightly less than your main div.

Thanx a lot! I knew it could be done but I just needed a lil guidance. Really helps!


Peace!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.