www.webdeveloper.com
Results 1 to 7 of 7

Thread: newbie question on aligning

  1. #1
    Join Date
    Jan 2010
    Posts
    3

    newbie question on aligning

    I have a question on the proper html commands to align for objects. I have scripts for 100px ad boxes that I'm trying to place in my blog. I can put them in a html text widget. The problem is that I'm trying to align all four so that are in a square shape (2 rows, 2 on top, 2 on the bottom) I tried the ALIGN code for left and right but that doesn't allow me to put one left and one right on the same line.

    Any help is appreciated.

    Mark

  2. #2
    Join Date
    Mar 2007
    Posts
    946
    If you can use css then use float: left. If not then you probably would have to do it with a table.

  3. #3
    Join Date
    Dec 2005
    Posts
    2,984
    This is always a good bet:

    HTML Code:
    <ul>
      <li>first block</li>
      <li>second block</li>
      <li>third block</li>
      <li>fourth block</li>
    </ul>
    Code:
    ul { width: 250px; }
    li { list-style-type: none; float: left; height: 100px; width: 100px; margin: 10px 25px 10px 0; border: 1px solid #000; display: block; }
    Should give you the desired effect you are looking for.

  4. #4
    Join Date
    Jan 2010
    Posts
    3
    Quote Originally Posted by aj_nsc View Post
    This is always a good bet:

    [html]
    <ul>
    <li>first block</li>
    <li>second block</li>
    <li>third block</li>
    <li>fourth block</li>
    </ul>
    that aligned the 4 boxes vertically in a line.

  5. #5
    Join Date
    Dec 2005
    Posts
    2,984
    My bad, try changing this:

    Code:
    ul { width: 275px; border: 1px solid #000; overflow: hidden; }
    The last two parts of the above rule show you what the container for the li's actually looks like so you can change the width as needed and actually see the results. Simple set the border width to 0 when displaying it live on your site.

  6. #6
    Join Date
    Jan 2010
    Posts
    3
    I ended up setting it up as a table. Which worked.

  7. #7
    Join Date
    Dec 2005
    Posts
    2,984
    Quote Originally Posted by linkedit View Post
    I ended up setting it up as a table. Which worked.
    Welcome to three-five years ago in the world of web design.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles