Radu Soigan Radu Soigan -4 years ago 115
CSS Question

Setting paragraph width 2 times the default size

<p>
<input type="text"/>
<input type="text"/>
</p>
<p>
<input type="text"/>
</p>


So I have 2 paragraphs ,and I was wondering if it is possible to set the width of the second paragraph 2 times it's normal width in order to be the same size as the one before which has a longer width due to the two input boxes.

Answer Source

You can use a table tag to put only the two paragraphs. The table cell that has the longest width will adjust all other cell to its width. Since the mentioned that the first paragraph is the longest,see snippet below

Note: paragraph 1 p1 has a red border with a width of 370px

td {
  border: solid black 1px;
}

#p1 {
  display: inline-block;
  width: 370px;
  border: solid red;
}
#p2{
  border: solid blue;
}
<table>
  <tr>
    <td>
      <p id="p1">
        <input type="text" />p1
        <input type="text" />270px
      </p>
    </td>

  </tr>
  <tr>
    <td>
      <p id="p2">
        <input type="text"/>p2
      </p>
    </td>

  </tr>
</table>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download