CMS scripting
CMS scripting

Reputation: 669

Carriage return showing on HTML code

I hate to ask but I had to. I have an html code. For some reason the carriage return is being saved and is being shown in my browser.

<div class="module">
    <p>Some data 

    some data <strong> more data
    more data</strong> and even more data </p>
</div>

Obviously I expect this to show:

Some data some data more data more data and even more data.

Instead, the paragraph is keeping the carriage returns / line breaks. I thought the problem was with Netbeans, so I downloaded Notepad++, but the problem persists. Thanks

I should add I am using this inside an .ctp file that belongs to CakePHP on a Windows machine, Apache WAMP server and that this data is explicit html, not echoed by php .

My current styling for the class is as follows:

.module{
     border: 1px solid   darkgrey;
     background-color: #F3F3F3;
     border-radius: 5px;
     padding:5px;
     margin-bottom: 1em;
     overflow:  auto;

}

I am also adding any applicable styling that might be affecting my code, maybe you guys can spot it.

body {

          margin: 0;
    padding: 0;
          font-family: 'Tahoma';
          letter-spacing: 1px;

}

p, ul, ol {
    margin-top: 0;
          line-height: 160%;

}

p{
          white-space: pre-wrap; /* css-3 */
          white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
          white-space: -pre-wrap; /* Opera 4-6 */
          white-space: -o-pre-wrap; /* Opera 7 */
          word-wrap: break-word; /* Internet Explorer 5.5+ */
}

the white space styling on the p tag I added it as a prevention to users that input long words without spaces as a form to break the page.

Upvotes: 0

Views: 4797

Answers (1)

Mr Lister
Mr Lister

Reputation: 46589

You do have white-space:pre-wrap on your p!

What did you think white-space:pre-wrap does? What were you trying to achieve?

Upvotes: 6

Related Questions