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
    Jul 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to i stop <div> from moving my text/images down?

    Hi, i'm new to web design/coding, thanks in advance.

    Is there a way to put <div> tags in but keeping everything on the same line,

    for instant if i put this in

    Code:
    <body>
        item1 <div>item2 item3</div> item4
    </body>
    i get something that looks like this

    item1
    item2 item3
    item4


    but i want it to look like this

    item1 item2 item3 item 4

    but with div id's and stuff only applying for item 2 and 3.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,621
    Thanks
    6
    Thanked 1,001 Times in 974 Posts
    Look into the definitions of block-level elements and inline elements. You would probably wanna use span instead of div which has the same semantically neutral nature as a division but on an inline level.

  • #3
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    divs are block elements - i.e they appear on their own "line", if you will.

    you should use <span> tags for "inline" content.

    alternatively you may do:

    Code:
    div { display:inline; }
    but i wouldn't recommend it

  • #4
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok cool thanks heaps, I'll use <span>, I still ddin't know as i'm still learning.


  •  

    Posting Permissions

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