How do you set the table width to 100%?

new BookmarkLockedFalling
donnybowers
Junior Member
**

donnybowers Avatar

My website was created in the mid 2000s. Unfortunately I lost the code somehow.
Posts: 70Male

Post by donnybowers on Jun 30, 2020 10:17:16 GMT -5

I tried the following:

html "<table width='100%'>"

I can't figure out a way to use the Run BASIC table commands to do this. I'm trying to overcome the fact that if I read in a document and print it to the screen, the text doesn't wrap like a normal html page. I should be able to make it wrap if I can put it into a table, but I need to be able to set the width of the table to a percentage of the screen. I'll need to do this if I want to have a sidebar also. I usually split the screen to about 25 percent sidebar and 75 percent for the content. I don't want the user to have to scroll left and right to read the document.

Here's the code I'm trying:


cssid #body, "{ font-family: Arial, Helvetica, sans-serif ; font-size: 24pt; background: #000; color:#fff; width: 100%; padding: 16px }"

div body
html "<table width='100%'><tr><td>"
open "projects\Bible_project\ylt\John1円.txt" for input as #1
while eof(#1)=0
line input #1, r$
print r$;
html "<br>"
wend
close #1
html "</td></tr></table>"
end div

Last Edit: Jun 30, 2020 10:20:11 GMT -5 by donnybowers
Any code I share on this forum is released to the public domain and may be used freely any way you like unless for some reason I specifically indicate otherwise in the post.
donnybowers
Junior Member
**

donnybowers Avatar

My website was created in the mid 2000s. Unfortunately I lost the code somehow.
Posts: 70Male

Post by donnybowers on Jun 30, 2020 10:32:50 GMT -5

I tried again with different approach:


cssid #body, "{ font-family: Arial, Helvetica, sans-serif ; font-size: 24pt; background: #000; color:#fff; width: 100%; padding: 16px }"

div body
html "<table width='500px'><tr><td>"
open "projects\Bible_project\ylt\John1円.txt" for input as #1
while eof(#1)=0
line input #1, r$
html "<p>"
print r$;
html "</p>"
wend
close #1
html "</td></tr></table>"
end div


It's the same as above except that there's an extra line feed between my paragraphs. The paragraphs stretch past the edge of the screen and don't wrap.
Last Edit: Jun 30, 2020 10:37:01 GMT -5 by donnybowers
Any code I share on this forum is released to the public domain and may be used freely any way you like unless for some reason I specifically indicate otherwise in the post.
donnybowers
Junior Member
**

donnybowers Avatar

My website was created in the mid 2000s. Unfortunately I lost the code somehow.
Posts: 70Male

Post by donnybowers on Jun 30, 2020 12:05:27 GMT -5

So I tried it with the Run BASIC "table" command like this:

dim txt$(1,1)

cssid #body, "{ font-family: Arial, Helvetica, sans-serif ; font-size: 24pt; background: #000; color:#fff; width: 100%; padding: 16px }"
cssclass "table", "{ width:100%; border-width:8px; }"

div body

open "projects\Bible_project\ylt\John1円.txt" for input as #1
txt$(1,1)=input$(#1, lof(#1))
close #1

table #chap, txt$()
render #chap


The text is trunkated at the border of the screen. If I try to use 500px instead of 100% nothing changes. You would think I would get a narrower table but I don't. It's exactly the same.I can't figure out what I'm doing wrong.
Last Edit: Jun 30, 2020 12:10:30 GMT -5 by donnybowers
Any code I share on this forum is released to the public domain and may be used freely any way you like unless for some reason I specifically indicate otherwise in the post.
meerkat
Senior Member
****

meerkat Avatar

Posts: 250

Post by meerkat on Jul 1, 2020 5:37:51 GMT -5

Browsers need a little help with wordwrap.

Maybe something like this will help..
Define word wrap..
WordWrap$ = "style='white-space: pre-wrap;";_
"white-space: -moz-pre-wrap;";_
"white-space: -pre-wrap;";_
"white-space: -o-pre-wrap;";_
"word-wrap: break-word'"



Then in the <table> you can display any notes$ and they will wordwrap no matter how they change the screen size.
html "<td ";WordWrap$;">";notes$;"</td>"


hope this helps..
Dan
donnybowers
Junior Member
**

donnybowers Avatar

My website was created in the mid 2000s. Unfortunately I lost the code somehow.
Posts: 70Male

Post by donnybowers on Apr 23, 2021 1:58:25 GMT -5

So I made a small table with just a few words in it and I was able to get the table to center on the screen like this:

<code>
html "<center>"
html "<table><tr><td>"
print "Hello Crazy World"
html "</td></tr></td>"
html "</center>"
</code>

This centers the table onto the screen as you would expect.

I was also able to use this to center the table:

<code>
cssclass "table", "{margin-left: auto; margin-right: auto;}"
</code>

EDIT: I don't know why the BBCode isn't working. I used the BBCode tab to do it. It just didn't work. It worked all the way up to this post.
Last Edit: Apr 23, 2021 2:03:16 GMT -5 by donnybowers
Any code I share on this forum is released to the public domain and may be used freely any way you like unless for some reason I specifically indicate otherwise in the post.