0

How can I avoid double line breaks (<br><br>) in a text field (field type: text unformatted, long)?

Users write text into this text field. When they hit Enter twice, the result is: <br><br>. But <br><br> is not themable with css, the height of <br> can NOT be set with css.

Therefore <br><br> should be avoided and paragraphs <p> used instead of it. <br><br> should never be saved to database. How can double <br><br> be avoided or replaced with <p> before the the field is saved?

5

1 Answer 1

-1

You can style br tag in CSS, but before you need to reset it by using these declarations:

br {
  display: "block";
  content: "";
}

Then you can style it as you want, it can be done using margin property, so the code will be such as:

br {
  display: "block";
  content: "";
  margin: 1em 0;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.