www.webdeveloper.com
Results 1 to 7 of 7

Thread: No line break after <div>

  1. #1
    Join Date
    Aug 2005
    Posts
    3

    No line break after <div>

    Hi,

    Is it possible to not have a line break after a div tag?

    Regards

    Pichdude

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Use <span>
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Aug 2005
    Posts
    3
    My code looks like this:
    <div id="Top" class="info"></div><a href="#" class="a_info"></a>

    How do you propose I use the <span> to not get a line break after the div?

  4. #4
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,714
    Quote Originally Posted by Pichdude
    My code looks like this:
    <div id="Top" class="info"></div><a href="#" class="a_info"></a>

    How do you propose I use the <span> to not get a line break after the div?
    Instead of this:
    <div id="Top" class="info"></div><a href="#" class="a_info"></a>

    Use this:
    <span id="Top" class="info"></span><a href="#" class="a_info"></a>

    Also, you could use this:

    <div id="Top" class="info"><a href="#" class="a_info"></a></div>

  5. #5
    Join Date
    Sep 2005
    Posts
    1
    If you absoultely must use a <div>, you can set

    div {
    display: inline;
    }

    in your stylesheet.

    Of course, that essentially makes the <div> a <span>.

  6. #6
    Join Date
    Jan 2009
    Posts
    1
    Your best bet is to first put the link inside the <div> tags, then set the display of that ID to inline so you do not blow out the default line break of all <div>s.

    I.E:
    HTML Code:
    #Top {display: inline}
    
    <div id="Top" class="info"><a href="#" class="a_info"></a></div>
    -Bryan Wolfford
    Last edited by glanzend; 01-03-2009 at 11:13 AM.

  7. #7
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Or drop both the div and the span and put the id into the <a> tag.
    Stephen

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