Results 1 to 8 of 8

Thread: Silly HTML question

  1. #1
    Senior Member
    Join Date
    Aug 2004
    Location
    W Yorkshire
    Posts
    5,691
    Thanks
    85
    Thanked
    15 times in 13 posts
    • XA04's system
      • Motherboard:
      • MSI X570-A Pro
      • CPU:
      • AMD Ryzen 5 3600
      • Memory:
      • Corsair 2x 8gb DDR 4 3200
      • Storage:
      • 1TB Serpent M.2 SSD & 4TB HDD
      • Graphics card(s):
      • Palit RTX 2060
      • PSU:
      • Antec Truepower 650W
      • Case:
      • Fractcal Meshify C
      • Operating System:
      • Windows 10
      • Monitor(s):
      • iiyama 34" Curved UWQHD
      • Internet:
      • Virgin 100mb Fibre

    Silly HTML question

    This is probably going to sound silly, but how can i get some text on the left of the page, and on the right, but on the same line using div tags?.

    Thanks

  2. #2
    Pixel Abuser Spunkey's Avatar
    Join Date
    Nov 2003
    Location
    Milton Keynes
    Posts
    1,523
    Thanks
    0
    Thanked
    0 times in 0 posts
    use the force. or CSS. whatevers good for you.

    float: left/right is the kiddie

  3. #3
    Senior Member
    Join Date
    Aug 2004
    Location
    W Yorkshire
    Posts
    5,691
    Thanks
    85
    Thanked
    15 times in 13 posts
    • XA04's system
      • Motherboard:
      • MSI X570-A Pro
      • CPU:
      • AMD Ryzen 5 3600
      • Memory:
      • Corsair 2x 8gb DDR 4 3200
      • Storage:
      • 1TB Serpent M.2 SSD & 4TB HDD
      • Graphics card(s):
      • Palit RTX 2060
      • PSU:
      • Antec Truepower 650W
      • Case:
      • Fractcal Meshify C
      • Operating System:
      • Windows 10
      • Monitor(s):
      • iiyama 34" Curved UWQHD
      • Internet:
      • Virgin 100mb Fibre
    what i mean is....

    using a div tag (just one... or two if it will stay on the same line) to get 2 pieces of text, one on the left, and one on the right. but on the same line.

    like:
    Left text here ------------------------------------------------------------Right text here

    (ignore the ------'s, its just because it doesn't like white space).

    i can get things to align to the left fine, and the right. Its just i want to know how to do it on the same line. Thanks

  4. #4
    HEXUS.social member Allen's Avatar
    Join Date
    Nov 2003
    Location
    Brighton
    Posts
    8,536
    Thanks
    363
    Thanked
    262 times in 168 posts
    • Allen's system
      • Motherboard:
      • ASUS Maximus VIII Gene
      • CPU:
      • Intel Core i5 6600K
      • Memory:
      • 2 x 8GB Kingston HyperX Predator DDR4-3000
      • Storage:
      • 256GB Samsung 950 PRO NVMe M.2 (OS) + 2 x 512GB Samsung 960 EVO in RAID 0 (Games)
      • Graphics card(s):
      • ASUS ROG Strix GeForce GTX 1080 Ti OC
      • PSU:
      • XFX P1-650X-NLG9 XXX 650W Modular
      • Case:
      • Fractal Design Node 804
      • Operating System:
      • Windows 10 Home 64-bit
      • Monitor(s):
      • 27" BenQ XL2730Z + 23" Dell U2311H
      • Internet:
      • Virgin Media 200Mbps
    Using a table perhaps?

  5. #5
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    You can do it in CSS quite easily, i just can't remember how

    Something like display:inline; for each. Actually no, you have to use <span> as <div> incurs a line break iirc. Then just do float:right; and float:left; for each <span>

  6. #6
    Senior Member
    Join Date
    Aug 2004
    Location
    W Yorkshire
    Posts
    5,691
    Thanks
    85
    Thanked
    15 times in 13 posts
    • XA04's system
      • Motherboard:
      • MSI X570-A Pro
      • CPU:
      • AMD Ryzen 5 3600
      • Memory:
      • Corsair 2x 8gb DDR 4 3200
      • Storage:
      • 1TB Serpent M.2 SSD & 4TB HDD
      • Graphics card(s):
      • Palit RTX 2060
      • PSU:
      • Antec Truepower 650W
      • Case:
      • Fractcal Meshify C
      • Operating System:
      • Windows 10
      • Monitor(s):
      • iiyama 34" Curved UWQHD
      • Internet:
      • Virgin 100mb Fibre
    Quote Originally Posted by KeZZeR
    You can do it in CSS quite easily, i just can't remember how

    Something like display:inline; for each. Actually no, you have to use <span> as <div> incurs a line break iirc. Then just do float:right; and float:left; for each <span>
    Thats it, cheers.

  7. #7
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    Well it would be if span was a block level element but its not so they'll just sit side by side. All you need is one div with the left content in it and then another div embedded in that one with float:right set on it. You'll hit problems if the main div has a background and/or a border and the right div is taller than the main one as it will just overlap rather than increase the height of the main div

    That probably won't make any sense if you read it but try it out and you'll see what I mean

  8. #8
    Senior Member
    Join Date
    Aug 2004
    Location
    W Yorkshire
    Posts
    5,691
    Thanks
    85
    Thanked
    15 times in 13 posts
    • XA04's system
      • Motherboard:
      • MSI X570-A Pro
      • CPU:
      • AMD Ryzen 5 3600
      • Memory:
      • Corsair 2x 8gb DDR 4 3200
      • Storage:
      • 1TB Serpent M.2 SSD & 4TB HDD
      • Graphics card(s):
      • Palit RTX 2060
      • PSU:
      • Antec Truepower 650W
      • Case:
      • Fractcal Meshify C
      • Operating System:
      • Windows 10
      • Monitor(s):
      • iiyama 34" Curved UWQHD
      • Internet:
      • Virgin 100mb Fibre
    Quote Originally Posted by Iain
    Well it would be if span was a block level element but its not so they'll just sit side by side. All you need is one div with the left content in it and then another div embedded in that one with float:right set on it. You'll hit problems if the main div has a background and/or a border and the right div is taller than the main one as it will just overlap rather than increase the height of the main div

    That probably won't make any sense if you read it but try it out and you'll see what I mean
    No, that makes sense and i was wondering about that problem as i wanted to use a background image. Thanks.

    edit: tried it out, and it just makes the text on the right flow below...

    if i use the way i did before with the two span tags^^^^^^^. the background will only show where the text is, so if i use css to change the width to 100%, it works, BUT the text floating on the right then jumps down a line again.
    Last edited by XA04; 16-05-2005 at 03:19 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Maybe a silly RAM question, but...
    By BlueMagician in forum PC Hardware and Components
    Replies: 3
    Last Post: 03-03-2005, 11:32 AM
  2. Silly Asus SATA RAID question..
    By BlueMagician in forum PC Hardware and Components
    Replies: 4
    Last Post: 12-02-2005, 02:36 AM
  3. Silly question about a soundblaster!
    By littlewill in forum PC Hardware and Components
    Replies: 2
    Last Post: 11-01-2005, 06:25 PM
  4. simple html question
    By Jimmy Little in forum Software
    Replies: 9
    Last Post: 20-09-2004, 10:27 AM
  5. this may sound like a silly question!
    By jester212 in forum PC Hardware and Components
    Replies: 9
    Last Post: 23-06-2004, 12:07 PM

Posting Permissions

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