Search code examples
javascripthtmlcssparagraphs

Place two paragraphs next to each other?


I've been experimenting with paragraphs and writing to them from the script tag and was wondering if there is a way to place them next to each other horizontally rather than underneath. My current code is like this:

<p id="csvData"></p>
<p id="csvData2"></p> 

I can't work out how to get "csvData" and "csvData2" to go to next to each other.


Solution

  • It isn't a script thing, this would easily be done via CSS.

    #csvData {
      border: 1px solid red;
      height: 200px;
      float: left;
      width: 45%;
    }
    #csvData2 {
      border: 1px dotted blue;
      height: 400px;
      float: right;
      width: 45%;
    }
    <p id="csvData"></p>
    <p id="csvData2"></p>