www.webdeveloper.com
Results 1 to 6 of 6

Thread: How can put div in the same with text??

  1. #1
    Join Date
    Aug 2006
    Posts
    28

    How can put div in the same with text??

    I have one line:
    "Hello every body"
    now, I put <div> </div> in the middle text like:
    "Hello every <div> </div> body"
    but, When put div tag, one line become 3 line, like:
    "Hello every
    <div> </div>
    body"

    I want when div tag can put, numbers of line is only one.
    How should I do?

  2. #2
    Join Date
    Jul 2004
    Location
    Sendai, Japan
    Posts
    1,273
    Use 'span' instead of 'div'.

  3. #3
    Join Date
    Aug 2006
    Posts
    28
    Quote Originally Posted by BonRouge
    Use 'span' instead of 'div'.
    Thanks very much
    I have another question:
    have <span> <span> </span> </span>
    now, I want the second span have a special position in the first span.
    I use: style="left: 234px; top: 116px;" in the second span tag.
    But This is position with browse, not in the first span

    How can I do
    Last edited by minhkhoi; 08-27-2006 at 12:12 PM.

  4. #4
    Join Date
    May 2006
    Posts
    135
    in your style sheet you could have just added

    display:block;
    to the div element.

    that will make it perform like a block level element.

    and for your answer for the first span use this

    PHP Code:
    <style type="text/css">
    span.a1{position:relative;}
    span.a1 span{position:absolute;left:234px;top:116px;}
    </
    style
    HTML Code:
    <span class="a1">
          <span>
            content for the span here
          </span>
    </span>
    try that.

  5. #5
    Join Date
    Aug 2006
    Posts
    28
    Thanks,
    Maybe I post not clearly
    I want the second span have special position with the first span.
    It means, the first span have style=" left: 200; top: 200, height: 100, width:100"
    it create a range 100 x 100 px with second span,

    In last question I want second span have only postion betwen:
    (*)
    + left: 200 to 300
    + top: 200 to 300
    with browser

    and:
    (**)
    + left: 0 to 100
    + top: 0 to 100
    with the first span

    AND, I find simplest solution is (*)
    Now, I need take position of first span.

    Unfortunately, I must create the <span> like:
    <span id="myspan" style="width:200;height:200"> 222 </span>
    without left and top and put it in my web site
    I think I can take it's postion: document.all.myspan.styte.left
    but not success

    What should I do?
    Please help me.
    Thanks everybody
    Last edited by minhkhoi; 08-27-2006 at 12:58 PM.

  6. #6
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    What should I do?
    Learn a lot more about CSS before you start trying to apply it. A div is a block element, hence your first problem. A span is an inline element, which makes it usable within a paragraph. But inline elements cannot have size or position assigned because they are inline. That means they are meant to flow naturally in the text and be the right size to contain their content. Maybe you should describe your design rather than the way you're trying to implement it.

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