www.webdeveloper.com
Results 1 to 5 of 5

Thread: How to get two paragraphs next to each other

  1. #1
    Join Date
    Jan 2006
    Posts
    27

    How to get two paragraphs next to each other

    This might be a stupid question, but is there a way to have two sections filled with text next to each other, preferably with an adjustable width, and when the window becomes to small, the second section goes into the next line (like a line break).

    Thanks in advance!

  2. #2
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Give each paragraph a width and then add float:left to the first paragraph. The second paragraph will then be moved to the right provided that there is room.
    Stephen

  3. #3
    Join Date
    Jan 2006
    Posts
    27
    Ah, yes, that works, thank you!

    P.S.: I had to do the float:left thing on both paragraphs though.

  4. #4
    Join Date
    Mar 2014
    Location
    Bucharest/Romania
    Posts
    1
    Quote Originally Posted by Markstar View Post
    Ah, yes, that works, thank you!

    P.S.: I had to do the float:left thing on both paragraphs though.
    You actually need to float only one of them. If you choose the right one to flow, then the second <p> should sit next to the floated <p> by default.

  5. #5
    Join Date
    Mar 2014
    Posts
    40
    Or you can use display:inline-block;

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