1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Two div's on the same "line"

Discussion in 'CSS' started by Exnie, Apr 18, 2008.

  1. #1
    Hi, I am coding my first wordpress theme and am having some trouble.

    So here's what I'm trying to do.

    I have two divs lets call them div1 and div2 and here's what it looks like in html:

    <div id="div1">here's div two</div>
    <div id="div12">here's div two</div>
    Code (markup):
    I want these div's to look like this when you go to the page:

    here's div one here's div two

    The only problem is it looks like this, like there's a break between the lines:

    here's div one
    here's div two



    Does anyone know what to put in style.css to fix this?
     
    Exnie, Apr 18, 2008 IP
  2. jordanthegreat

    jordanthegreat Active Member

    Messages:
    390
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Yes. Div's will by default list themselves one under the other unless you apply some other properties to them. add something like this to your css:

    #div1 {
    float:left
    }

    that should get them side by side. further attributes may need to be added to them depending on what you want to do with them.
     
    jordanthegreat, Apr 18, 2008 IP
  3. busman3000

    busman3000 Peon

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can also add the property:

    display:inline

    That should work.
     
    busman3000, Apr 18, 2008 IP
  4. jordanthegreat

    jordanthegreat Active Member

    Messages:
    390
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    diplay:inline works too. but add it to both div's.

    note though that display:inline is not a block. you will not be able to define its width or height nor apply vertical margins/padding.
     
    jordanthegreat, Apr 18, 2008 IP