/    Sign up×
Community /Pin to ProfileBookmark

CSS file is not working as expected on cellphone

I’m a programmer from way back, but most of my experience has been in application programming, not website development. I have been working on a website on and off for a few years now, so I’m familiar with html, javascript, etc. I’m not a guru, but not a newbie either. I am taking my first step at responsive programming and I am a total newbie at displaying an app on a cellphone. I took my first stab at it and I’m relatively happy that I got it going with a few pokes at it.

But I have something that stumps me about the rendering on my cellphone. It appears that the CSS file is being read, because it is displaying the background color specified. The rendering of the various divs in the body of the html does not display the colors specified for in the CSS file.

My understanding may be incorrect, but I think the divs should be displayed in the same color regardless of the target. All colors show up on my computer display.

I’m using the Apache Tomcat 8.0 JSP container on computer as the web server on my intranet. My cellphone target is a ZTE cellphone running andriod. I tried looking at the example on an LG cellphone, using Firefox and Opera browers and got the same results.

I tried to attach example files, but I had problems uploading. I will try to upload some files after I get this thread started.

Jim A.

to post a comment

18 Comments(s)

Copy linkTweet thisAlerts:
@jjanderson5authorFeb 23.2020 — I tried to attach my CSS file and primary JSP file, but I am getting error messages. Below, I am pasting my CSS file.


html, body {margin:0px;}

/*
* SCCS - %Z% %P% - %I% - %H%
*
* Default css2.1 setting taken from the spec Appendix D
*/
address,
blockquote,
dd, div,
dl, dt, fieldset, form,
frame, frameset,
h1, h2, h3, h4,
h5, h6, noframes,
ol, p, ul, center,
dir, hr, menu, pre { display: block }
li { display: list-item }
head { display: none }
th { font-weight: bolder; text-align: center }
caption { text-align: center }
body { margin: 8px }
h1 { font-size: 2em; margin: .67em 0 }
h2 { font-size: 1.5em; margin: .75em 0 }
h3 { font-size: 1.17em; margin: .83em 0 }
h4, p,
blockquote, ul,
fieldset, form,
ol, dl, dir,
menu { margin: 1.12em 0 }
h5 { font-size: .83em; margin: 1.5em 0 }
h6 { font-size: .75em; margin: 1.67em 0 }
h1, h2, h3, h4,
h5, h6, b,
strong { font-weight: bolder }
blockquote { margin-left: 40px; margin-right: 40px }
i, cite, em,
var, address { font-style: italic }
pre, tt, code,
kbd, samp { font-family: monospace }
pre { white-space: pre }
button, textarea,
input, select { display: inline-block }
big { font-size: 1.17em }
small, sub, sup { font-size: .83em }
sub { vertical-align: sub }
sup { vertical-align: super }
thead, tbody,
tfoot { vertical-align: middle }
td, th, tr { vertical-align: inherit }
s, strike, del { text-decoration: line-through }
hr { border: 1px inset }
ol, ul, dir,
menu, dd { margin-left: 40px }
ol { list-style-type: decimal }
ol ul, ul ol,
ul ul, ol ol { margin-top: 0; margin-bottom: 0 }
u, ins { text-decoration: underline }
br:before { content: "A"; white-space: pre-line }
center { text-align: center }
:link, :visited { text-decoration: underline }
:focus { /* outline: thin dotted invert */
outline-style: dotted;
outline-color: red;
outline-width: thin;
}

/* Begin bidirectionality settings (do not change) */
BDO[DIR="ltr"] { direction: ltr; unicode-bidi: bidi-override }
BDO[DIR="rtl"] { direction: rtl; unicode-bidi: bidi-override }

*[DIR="ltr"] { direction: ltr; unicode-bidi: embed }
*[DIR="rtl"] { direction: rtl; unicode-bidi: embed }

@media print {
h1 { page-break-before: always }
h1, h2, h3,
h4, h5, h6 { page-break-after: avoid }
ul, ol, dl { page-break-before: avoid }
}
/************************************************************
* End of default settings
************************************************************/



body {
background:pink;
margin: 19px 19px 0 9px;
padding: 0;
}

#allContent {
/* color:#ff0000; */
color: black;
}

#startTestIframID {
font-size: 24pt;
color: yellow;
}

#scheduleEvent {
background:yellow;
font-size:48px;
font-style:italic;
font-weight:bold;
text-align:center;
font-family:cursive;
border-style: ridge;
border-width: 9px;
}

#topHorizontal1 {
background:yellow;
height:100px;
font-size:48px;
font-style:italic;
font-weight:bold;
text-align:center;
font-family:cursive;
border-style: ridge;
border-width: 9px;
}

#topHorizontal2 {
background:purple;
font-size:16px;
color: yellow;
text-align:center;
border-style: ridge;
border-width: 9px;
height:100px;
}

#topHorizontal3 {
background:gray;
color: yellow;
text-align:center;
font-size:16px;
height:20px;
}

#content {
background:lightgreen;
color: blue;
text-align:center;
font-size:16px;
height:20pxblue
}

#ads {
background:green;
color: orange;
text-align:center;
font-size:16px;
}


.formfield * {
vertical-align: middle;
margin: auto;
background: orange;
font-size:50px;
}

.toolBarTable {
padding-top : 0px;
margin-top : 0px;
vertical-align: top;
}

.imageText {
margin-top: 0.1em;
margin-bottom: 0.1em;
}

.imageTextClass {
color: yellow;
background: gray;
padding: 1px;
line-height: 50%;
}

.tableImageCLass {
position: relative;
}

.tableImageTextClass {
position: absolute;
top: 20px;
left: 0;
}

tr.imageSpacer > td {
padding-bottom: 2em;
}

/* This was not working - I wanted to put the warning in yellow, not red.
#afterStreetAddress1 span.error {
font-size: 0.8em;
color: #FF0;
font-weight: bold;
display: block,
margin-left: 215px;
}
*/

/* Styling used for JQuery error message and my own error messages. See customerRegister.jsp
* for an example of my usage.
*/
#customerRegisterForm label.error, #customerRegisterRerunForm label.error, #customerRegisterForm span.error, #customerRegisterRerunForm span.error {
font-size: 0.8em;
color: #F00;
font-weight: bold;
display: block;
margin-left: 215px;
}

.tabletext {
padding-top : 0px;
margin-top : 0px;
color: yellow;
/* background-color : maroon; */
}

.tablebutton {
background-color : gray;
color: yellow;
}

.hidden {
/* display : none; */
height : 0%;
font-size: 0px;
}

.form_title {
font-size:40px;
color: purple;
}

.division {
height:100%;
float:left;
width:8%;
position:relative;
/* background-color: blue; */
}

#toolBarDiv {
height:100%;
width:84%;
float:left;
position:relative;
/* background-color: blue; */
}

#mainTitle {
font-size:24px;
font-weight:bold;
}

#topLevel {
background:pink;
border-collapse: collapse;
height: 95%;
}

#content {
float: left ;
width: 80% ;
}

#ads {
float: left;
width: 20%;
}

.cascadedSelect {
float: left;
background:lightgray;
}

#topic_id, #type_id,
#pokerLevel_id, #theaterLevel_id, #movieLevel_id, #festivalLevel_id,
#pokerType_id, #theaterType_id, #movieType_id, #festivalType_id,
#init_topic_id, #init_moreTopic_id { float: left }

#travel_id, #init_travel_id, #init_moreTravel_id, #pre_travel_id,
#travelLevel_id, #trainLevel_id, #planeLevel_id, #carLevel_id, #busLevel_id,
#planeMethod_id, #trainMethod_id, #busMethod_id, #carMethod_id { float: left }

#dblname1, #dblname2 { float: left }

#topicresult_id, #travelresult_id { clear: both }

#sel_double, #hor1_id { clear: both }


#topicresult_id, #travelresult_id {
background:pink;
}

#sampleresult {
background:darkgray;
display: block;
padding: 10px;
margin: 2px 2px 0 2px;
height:20px;
width:100%;
font-size: 12pt;
}

#mid {
background:lightgreen;
width: 95%;
padding: 10px;
margin: 2px 2px 0 2px;
}

#maincontent {
display: flex
}

#footer {
clear: both ;
text-align:center;
font-size:20px;
font-weight:bold;
background:lightyellow
}

#aboutus {
text-align:center;
font-size:20px;
font-weight:bold;
background:darkblue
}

.containingBox {
display: flex;
flex-flow: column;
}

.containingBox .flexDivA {
display: flex;
background: blue;
color: black;
order: 3;
flex: 0 auto;
align-self: auto;
min-width: auto;
min-height: auto;
}

/* Commented out because I could not get flexboxes within flexboxes to work
// The example is in tableDiv.jsp, but is commented out.
// .containingBox .flexDivA .flexDevD {
// background: blue;
// color: black;
// order: 3;
// flex: 1 auto;
// align-self: auto;
// min-width: auto;
// min-height: auto;
// }
*/

/* Commented out because I could not get flexboxes within flexboxes to work
// The example is in tableDiv.jsp, but is commented out.
// .containingBox .flexDivA .flexDevE {
// background: purple;
// color: red;
// order: 1;
// flex: 0 auto;
// align-self: auto;
// min-width: auto;
// min-height: auto;
// }
*/

/* Commented out because I could not get flexboxes within flexboxes to work
// The example is in tableDiv.jsp, but is commented out.
// .containingBox .flexDivA .flexDevF {
// background: black;
// color: white;
// order: 2;
// flex: 0 auto;
// align-self: auto;
// min-width: auto;
// min-height: auto;
// }
*/

/********************************************************************************
*
* popup example taken from https://www.w3schools.com/howto/howto_js_popup.asp
*
********************************************************************************/

/* Popup container */
.popup {
position: relative;
display: inline-block;
cursor: pointer;
}

/* The actual popup (appears on top) */
.popup .popuptext {
visibility: hidden;
width: 160px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 8px 0;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -80px;
}

/* Popup arrow */
.popup .popuptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}

/* Toggle this class when clicking on the popup container (hide and show the popup) */
.popup .show {
visibility: visible;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s
}

/* Add animation (fade in the popup) */
@-webkit-keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
}

@keyframes fadeIn {
from {opacity: 0;}
to {opacity:1 ;}
}
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 23.2020 — <i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset="ISO-8859-1"&gt;&lt;/meta&gt;
&lt;body bgcolor="lightblue" style=margin:9px 9px 0 9px;padding:0;&gt;

<i> </i> &lt;base href="http://localhost:8080/example/"&gt;&lt;/base&gt;
<i> </i> &lt;link rel="stylesheet" type="text/css" href="pages/fdivs_example.css"&gt;&lt;/link&gt;
<i> </i> &lt;script src="javascript/MM_JAVASCRIPT2E/_js/jquery-3.3.1.js"&gt;&lt;/script&gt;
<i> </i> &lt;link rel="mercury icon" href="/example/images/favicon.icon" type="image/x-icon"&gt;&lt;/link&gt;
<i> </i> &lt;script&gt;
<i> </i> console.log("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
<i> </i> $(document).ready(function() {
<i> </i> console.log("page1.jsp: HERE8010: document.ready is being run");
<i> </i> }); //end ready
<i> </i> &lt;/script&gt;
<i> </i> &lt;/head&gt;
<i> </i> &lt;body&gt;
<i> </i> &lt;div id="topLevel"&gt;
<i> </i> &lt;div id="topHorizontal1" title="Example" &gt;
<i> </i> &lt;title&gt;Example Development&lt;/title&gt;
<i> </i> Example Development
<i> </i> &lt;/div&gt;
<i> </i> &lt;div id="topHorizontal2"&gt;
<i> </i> &lt;br&gt;&lt;/br&gt;
<i> </i> css style file is 'fdivs_example.css'.
<i> </i> &lt;/div&gt;
<i> </i> &lt;div id="topHorizontal3"&gt;
<i> </i> CHECKPATH tophorizontal3.xhtml customerLoginValid is false
<i> </i> &lt;/div&gt;
<i> </i> &lt;div id="maincontent" title="Container"&gt;
<i> </i> &lt;div id="content"&gt;
<i> </i> TODAY in content.jsp
<i> </i> &lt;p&gt;Working on loggedIn is false.&lt;/p&gt;
<i> </i> &lt;p&gt;
<i> </i> Working on homePage, which is the default
<i> </i> 'func' if no other function is specified.
<i> </i> This should probably never happen.
<i> </i> &lt;/p&gt;
<i> </i> &lt;/div&gt;
<i> </i> &lt;div id="ads"&gt;
<i> </i> &lt;h1&gt;Right Divs&lt;/h1&gt;
<i> </i> &lt;p&gt;
<i> </i> This is page 1 right content from a paragraph.
<i> </i> It was dynamically generated as needed.
<i> </i> &lt;/p&gt;
<i> </i> &lt;/div&gt;
<i> </i> &lt;/div&gt;
<i> </i> &lt;div id="footer" company="Example.com" Title="footer"&gt;
<i> </i> &lt;i&gt;Development Examples&lt;/i&gt;
<i> </i> &lt;br&gt;&lt;/br&gt;
<i> </i> &lt;hr&gt;&lt;/hr&gt;
<i> </i> Copyright&amp;copy; 2020 Examples.com
<i> </i> &lt;/div&gt;
<i> </i> &lt;div id="aboutus" company="Examples.com" Title="footer"&gt;
<i> </i> ABOUT US GOES HERE
<i> </i> &lt;/div&gt;
<i> </i> &lt;/div&gt;
<i> </i> &lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@SempervivumFeb 23.2020 — You better use code tags when posting code: `your code here`

I edited your postings accordingly.
Copy linkTweet thisAlerts:
@tracknutFeb 23.2020 — I haven't tested your code by any means, but note that I don't see a doctype at the beginning of the html; I see a <body> tag inside the <head> section; I see a <meta> tag with non-matched (ie odd number of) quotes in it; Terminations of tags like </meta>, </base> etc which are not correct. In any event, you should run this code through a validator to catch and fix these errors (https://validator.w3.org)
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — @Sempervivum

Thanks for the help. I did try to enter it we code tags a couple of times and got error messages each time :(

I was probably doing something wrong, but I have not clue what I was doing wrong.
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — @tracknut

I will do the validation. Thanks for the suggestion.

Jim A.
Copy linkTweet thisAlerts:
@lionelmessiFeb 24.2020 — Thanks you!
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — 
I have run my html file through validation and removed all the errors. Next,

I have tried to upload my CSS and html file, but I get the error message:

'Uploading files of this type is not allowed.'

Is there a reason why that type of error occurs? I tried changing the extension on these files to '.txt', but that did not help.



Jim
Copy linkTweet thisAlerts:
@tracknutFeb 24.2020 — @jjanderson5#1615168 What are you uploading the files to? Your web site? What tool are you using to upload them?
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — @tracknut#1615169

When I am uploading the files, I am working on Firefox at the Webdeveloper.com website and I am working in a pop-up response screen which I assume is generated by Webdevelper.com. The pop-up is a boxed window that shows up in the lower left to the parent window. In fact, as I type this in, my input shows up in both the pop-up and the parent window.

At the bottom of the pop-up window there is a "Post Reply" bar that has 13 icons, which when I pass over them with the cursor show, "Preview", "Attach", "Add header text", etc. It is when I click on the "Attach" icon to attach a file to the message that I get the error message.
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — RESOLVED (sort of).

I have been doing research on this problem. I have not written code to make my app work on my cellphone yet, but I have found an explanation as to why it is not working.

Basically, a web application on a computer and a web app on a cellphone are two different animals. All my experience on web development until recently has been using a computer running Linux. Running html code developed on LInux but being run on Android requires that the Andriod guidelines be followed. My next stop is at https://developer.android.com/jetpack/docs/guide. Following the Android guidelines, I can hopefully get my web page to display properly.

Jim A.
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — @jjanderson5#1615186

I almost took down my last reply, but I'm leaving it so that my line of thought is maintained.

After thinking a few minutes more about my problem, i.e. CSS is not working with my html, I realized, that writing an Android app is not really what I am looking to do. What I want to do is write website JSP/html code that runs in a web browser and has a reasonable and similar appear when displayed on a computer screen or a cellphone screen.

To do this, the browser must read the CSS file. I am reverting back to trying to discover why the CSS file is not read on my cellphone when I read the html file into the browser. I plan to test on other browsers, but currently I am testing with Firefox, Opera and Chrome.
Copy linkTweet thisAlerts:
@tracknutFeb 24.2020 — Have you put the files on a web server that you could link here for us to see?

This code:
``<i>
</i>&lt;base href="http://localhost:8080/example/"&gt;&lt;/base&gt;<i>
</i>
``

is a likely fail, as it redirects all relative links, including the link to your stylesheet, to be looking at localhost for the content. Presuming that's not a directory on your cell phone, the link would fail. But that link should fail also on *any* browser if you've put the code on a web site rather than just running it on your own computer. So basically get rid of that <base> tag completely at the moment, and make your links (if they are not already) point to where they need to point, relative to where the html file sits.
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — Thank you very much for the input! I will explore this and report back, but it may take a day or two to respond because I have some commitments coming up.

BTW, I tried accessing my localhost from another PC on my intranet and I got the same result that I was getting on my cellphone. SO it is not a cellphone issue at all. Your comment about the <base> tag explains this and I am anxious to give it shot.

I'm sure I can find a web server to post code to, but I'm not going to do that until I test out your suggestion.

Jim
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — @tracknut#1615191

I squeezed some time and tried you suggestion. Sure enough, that was the problem. Thank you again.

That <base> tag was from some old code that I had and I looked over it w/o a 2nd thought. It helps so much to have a 2nd or 3rd pair of eyes to look at code.

BTW, the bigger item I took away from this is to not only test on my development platform, but test it from a cellphone AND a remote computer.

Jim
Copy linkTweet thisAlerts:
@jjanderson5authorFeb 24.2020 — RESOLVED. Great job by tracknut!!
Copy linkTweet thisAlerts:
@tracknutFeb 24.2020 — You're welcome, glad it's working :)
Copy linkTweet thisAlerts:
@webdiosFeb 24.2020 — glad to see you got it resolved, good catch by @tracknut#1615191

[webdios](https://www.webdios.com)
×

Success!

Help @jjanderson5 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...