Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Posts
    241
    Member #
    15910
    Hello,
    1) If I want to place a div withing another div, how can I align the second divs position with respect to the parent div? What is the css command for that?
    2) As I was told that the tables are not a good way to position elements, I decided to position divs inside parent div...So I need to know how can I position the smaller divs in relation to the parent div....Is my thinking correct first of all?
    3) Also, this must be a very basic question but, in general when desinging a website, do you do one parent div, and then smaller divs inside of that parent div nested as applicable, is that how this works? So lets say the whole background of your webpage would be the backgorund of the parent div, and then as you prefer you insert more backgrounds for any smaller divs inside...Is this how this is done / most logical or common way?

  2.  

  3. #2
    Junior Member
    Join Date
    Feb 2009
    Posts
    3
    Member #
    18419
    It looks like you are facing the same issues I have been through the last two weeks. Getting a hang on using div's instead of tables can appear rather confusing at first.

    What you want to do is achievable. This is the website I used to get a basic understanding. I hope it helps.

    There are 2 main ways of positioning divs inside each other in CSS:

    1) The float command is used to tell which side of the parent div to fit to:
    float: left;
    float: right;

    This is useful, as when one div is in and fitted to the left edge, you can define another and fit it to the left to, which will appear next to it, until you fill up the width of the parent div.

    2) Margins and Padding. Margins force a gap around the outside edge of the div in which they are set. Padding forces a gap around the inside edge of the div in which they are set. A quick breakdown of commands are:

    margin: 1px; (1px can also be 1%)
    margin-left: 1px;
    margin-right: 1px;
    margin-top: 1px;
    margin-bottom: 1px;

    padding: 1px; (1px can also be 1%)
    padding-left: 1px;
    padding-right: 1px;
    padding-top: 1px;
    padding-bottom: 1px;

    Be careful when using %, as it will be a % of the parent div.

    I hope this helps and gets you started.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:36 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com