The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> <pre> giving unwanted line breaks
Old Timer 99
post Oct 26 2019, 05:48 PM
Post #1





Group: Members
Posts: 2
Joined: 26-October 19
Member No.: 27,024



I am a total newcomer to HTML and CSS. I was told that I should not use HTML tags because of deprecation. I'm having a great deal of difficulty achieving what I need to.

I am trying to create a rather simple text email in HTML. I am using <pre> to preserve whitespace and line feeds. The <pre> itself is causing unwanted linefeeds. I've googled for a solution and see that using either margin:0; or display:inline; should solve the problem but I cannot figure out how to implement that fix.

I have worked many, many hours on this but don't have much to show for it. I've tried many different approaches to solve this extra linefeed problem but can't find anything that will stop it. This is what I have so far, I don't know if the way I am doing this is dumb or not.

<!DOCTYPE html>
<html>
<head>
<style>
pre.a {
font-family: arial;
font-size: 16px;
font-weight: normal;
color: blue;
margin: 0px;
}
pre.b {
font-family: Courier New;
font-size: 12px;
font-weight: normal;
color: black;
margin: 0px;
}
pre.blue {
font-family: Courier New;
font-size: 12px;
font-weight: normal;
color: blue;
margin: 0px;
}
</style>
</head>
<body>
<pre class="a">
ESXi Server Summary Report v3.8
Generated 10-25-2019
</pre><pre class="blue">


I will very much appreciate any suggestions.
Thank you in advance.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 26 2019, 06:18 PM
Post #2


.
********

Group: WDG Moderators
Posts: 8,295
Joined: 10-August 06
Member No.: 7



QUOTE(Old Timer 99 @ Oct 27 2019, 12:48 AM) *

I was told that I should not use HTML tags because of deprecation.

That's not correct, HTML is the foundation of all web pages. There are a few older HTML elements that are deprecated, but browsers still support them for legacy reasons and you won't hurt anything by using them (even though it may not be best practice).

Here's a table of the HTML4.01 elements, with the deprecated ones marked with a "D": https://www.w3.org/TR/html401/index/elements.html. To confuse things further, some of these deprecated element have been redefined and reintroduced in HTML5. But if you're a beginner I recommend that you start with HTML4, if nothing else because the documentation is far easier to understand.

QUOTE
I am using <pre> to preserve whitespace and line feeds. The <pre> itself is causing unwanted linefeeds.

In what way? If you mean at the beginning and the end, it may help to remove it like this:

CODE
<pre class="a">                             ESXi Server Summary Report v3.8
                                  Generated 10-25-2019</pre>

But in general it's best to avoid writing entire web pages using the PRE elements, since you'll lose most of the advantages of HTML (like fluid text, semantic HTML, etc).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 26 2019, 08:03 PM
Post #3


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,531
Joined: 9-August 06
Member No.: 6



I guess the OP means the margin browsers put around PRE. There are at least two PRE but the sample is cut off.

But that is taken care of properly in the CSS. I see no margins (if I complete the second PRE). So what is it you see, Old Timer 99?

Most important, whoever told you not to use HTML should have kept his silence. That's just plain poppycock. HTML away! happy.gif
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 26 2019, 09:54 PM
Post #4


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,531
Joined: 9-August 06
Member No.: 6



Or do you mean there is a line break between the two PRE elements? PRE is a block level element, so that would happen.

There is a CSS property called 'display'. With that you can make a block level element, like for instance P, inline and it will break the line no more. For some reason that has no effect on PRE. I haven't looked into this before, but it feels a little contradictory to try to do this.

User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Dec 19 2019, 05:48 AM
Post #5


Member
***

Group: Members
Posts: 97
Joined: 24-October 06
Member No.: 549



I like the red color of the code in the first post. So readable...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Dec 19 2019, 05:51 AM
Post #6


Member
***

Group: Members
Posts: 97
Joined: 24-October 06
Member No.: 549



Anyone here know member 'Sorokina19'? I've received private message about some sex with her... maybe Darin has her phone number... smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 19 2019, 06:45 AM
Post #7


.
********

Group: WDG Moderators
Posts: 8,295
Joined: 10-August 06
Member No.: 7



QUOTE(Dag @ Dec 19 2019, 11:51 AM) *

Anyone here know member 'Sorokina19'? I've received private message about some sex with her... maybe Darin has her phone number... smile.gif

Did you get that message recently? Sorokina19 sent Private Message spam in May this year, and should have been suspended since then. unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Dec 19 2019, 10:02 AM
Post #8


Member
***

Group: Members
Posts: 97
Joined: 24-October 06
Member No.: 549




It was some kind of pop-u window... it is not saved in my private messages...

So, she is the nun now? What church? biggrin.gif

QUOTE(Christian J @ Dec 19 2019, 03:45 PM) *

QUOTE(Dag @ Dec 19 2019, 11:51 AM) *

Anyone here know member 'Sorokina19'? I've received private message about some sex with her... maybe Darin has her phone number... smile.gif

Did you get that message recently? Sorokina19 sent Private Message spam in May this year, and should have been suspended since then. unsure.gif

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 19 2019, 10:16 AM
Post #9


.
********

Group: WDG Moderators
Posts: 8,295
Joined: 10-August 06
Member No.: 7



QUOTE(Dag @ Dec 19 2019, 04:02 PM) *

It was some kind of pop-u window... it is not saved in my private messages...

Was it an old message that you saw just now, or did she send it today?

QUOTE
So, she is the nun now? What church? biggrin.gif

How would I know, moderators don't get messages like that. laugh.gif

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Dec 20 2019, 01:54 AM
Post #10


Member
***

Group: Members
Posts: 97
Joined: 24-October 06
Member No.: 549



QUOTE(Christian J @ Dec 19 2019, 07:16 PM) *

Was it an old message that you saw just now, or did she send it today?


As I am coming here twice per year as average, your mention date (may 2019 (or it was 2017?)) was correct. Don't bother.. she is not 19 any more biggrin.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 20 2019, 11:31 AM
Post #11


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,531
Joined: 9-August 06
Member No.: 6



tongue.gif
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th February 2020 - 01:42 PM