The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> A Couple of CSS Questions For Displaying ASCII Art
sgtscott
post Dec 4 2023, 09:03 AM
Post #1





Group: Members
Posts: 6
Joined: 4-December 23
Member No.: 29,094



Can I remove this gap at the top of the page?

IPB Image

I have tried
margin: 0;
padding: 0;
border: 0;
outline: 0;

and more but nothing I do seems to be able to get rid of it. It is there in Chrome, Edge and Brave.

and also,

I wrote a VB.Net program that lets you load any small image and then converts that image to ASCII art as HTML. I currently write the HTML as (for example):

CODE
<html>
<head>
<body bgcolor = "#000000">
<pre><font face = "Courier New" size ="1">
<font color = "#660099">F</font><font color = "#660066">v</font><font color = "#660066">v</font>...

and then end the file with:

...<font color = "#002B00">:</font><font color = "#660066">v</font><font color = "#660099">F</font>
</pre>
</body>
</html>


It simply copies the color image loaded and makes a grayscale copy and then based on that value, picks an ASCII character (I have 92 characters all weighted from darkest to lightest) mapped to a gray shade value 0 to 255.

Then with the original color image I take the RGB and convert it to <font color = "#RRGGBB>&#ASC Value</font>.

and this works well EXCEPT Courier New is slightly taller that it is wide so my ASCII art looks a bit stretched. I could change my code to "squash" the image before rendering the HTML, but I wondered if instead there was a CSS statement that could make Courier New (or any fixed width font) to have a 1 to 1 aspect ratio when displayed?

Thank you
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Christian J
post Dec 4 2023, 03:54 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,665
Joined: 10-August 06
Member No.: 7



The PRE element itself also has a default margin that needs to be removed with CSS.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 4 2023, 04:12 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,734
Joined: 9-August 06
Member No.: 6



What browser? I didn't remember if it has amargin and sloppy as I am I only checked in k-mel and there it was none.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 4 2023, 04:20 PM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,734
Joined: 9-August 06
Member No.: 6



What the heck do you use? Opera?

Checked in FF and Edge. No margin.

Was going to try IE and then I got this:

CODE
The future of Internet Explorer is in Microsoft Edge.
Internet Explorer (IE) has been retired and is no longer supported. If any site you visit needs Internet Explorer, you can reload it with IE mode in Microsoft Edge. Select "Continue" to get started with Microsoft Edge, the fast and secure browser built for Windows.
Your favorites, passwords, history, cookies, and other browser data will be automatically brought over to Microsoft Edge so you can seamlessly continue browsing.


No choices here. I don't think I have any personal bookmarks in IE but they usually add a bunch by default and I don't want them transferred. But there is no way to say no, not even to close the window, just the Continue button. So Ctrl+Alt+Delete. No EI. Took a while to realize it was one of the Edge processes...

Sigh.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 5 2023, 06:13 AM
Post #5


.
********

Group: WDG Moderators
Posts: 9,665
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Dec 4 2023, 10:20 PM) *

What the heck do you use? Opera?

Checked in FF and Edge. No margin.

Tried FF and Vivaldi. Here's my sample code:

CODE
body {
margin: 0;
padding: 0;
}

pre {
background: pink;
margin: 0;
}

<body>

<pre>foo
bar</pre>

</body>

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 5 2023, 10:53 AM
Post #6


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,734
Joined: 9-August 06
Member No.: 6



QUOTE(Christian J @ Dec 5 2023, 12:13 PM) *

QUOTE(pandy @ Dec 4 2023, 10:20 PM) *

What the heck do you use? Opera?

Checked in FF and Edge. No margin.

Tried FF and Vivaldi. Here's my sample code:


I know. As said I was sloppy and just checked the top page margin. Sorry. wub.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


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

 



- Lo-Fi Version Time is now: 9th May 2024 - 02:51 AM