How do I set up a "box" for my text?

46 Views Asked by At

I want to put text in a borderless box on my code. Reason is so that I can make the paragraph text not go all the way across the page and have them start a new line early.

2

There are 2 best solutions below

0
On

This can be done by setting a % width to the <p> in your css or making a custom style to use in your div, see http://jsfiddle.net/sycoinc/k8dgxkLs/ for an example

0
On

I'm sorry for an incredibly vague answer, but it's only as vague as your question. If you need details, please modify your question and describe the end result. Anyway:

div {
  margin: 10px 0;
  }

p {
  margin: 0 50px;
}
<body>

  <div>Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size.</div>

  <p>Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size. Shorter paragraph size.
  </p>

  <div>Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size. Normal paragraph size.</div>

</body>

I hope this helps!