Pages: [1]   Go Down
Author Topic: CSS sheet via println?  (Read 533 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a little server setup that prints out some HTML to a client. As you can see in my code, I have linked to a CSS sheet on another server. Everything prints into the HTML but when I open the page, I don't see the styles in the browser. But if I ctrl-u, the css link is active and when clicked, I can see the stylesheet... but alas... not working.

Am I missing something... obviously what I did below didn't work.

Am I limited to only using inline CSS styles? or...something... I did search for the answer, but nothing yet... thanks.

Could it be some sort of settings from the CSS file host server that I have to change?   ....sorry, I'm a bit noob...



arduino code -
Code:
client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<LINK rel='stylesheet' type='text/css' href='http://www.seanandersondesigns.com/arduino.css'/>");
          client.println("<TITLE>Super Amazing Class Project</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Super Amazing Light Control</H1>");
         
          client.println("<a href=\"/?on\">ON</a>");
          client.println("<a href=\"/?off\">OFF</a></br>");
         
          client.println("<a href=\"/?on2\">ON</a>");
          client.println("<a href=\"/?off2\">OFF</a></br>");
         
          client.println("<a href=\"/?on3\">ON</a>");
          client.println("<a href=\"/?off3\">OFF</a></br>");
         
          client.println("<a href=\"/?on4\">ON</a>");
          client.println("<a href=\"/?off4\">OFF</a></br>");
         
          client.println("</BODY>");
          client.println("</HTML>");

HTML from ctrl-u
Code:
<HTML>
<HEAD>
<LINK rel='stylesheet' type='text/css' href='http://www.seanandersondesigns.com/arduino.css'/>
<TITLE>Super Amazing Class Project</TITLE>
</HEAD>
<BODY>
<H1>Super Amazing Light Control</H1>
<a href="/?on">ON</a>
<a href="/?off">OFF</a></br>
<a href="/?on2">ON</a>
<a href="/?off2">OFF</a></br>
<a href="/?on3">ON</a>
<a href="/?off3">OFF</a></br>
<a href="/?on4">ON</a>
<a href="/?off4">OFF</a></br>
</BODY>
</HTML>
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have styles working fine if I write them out inline in head tags... but... I need to have someone else who does not have the Arduino to be able to work on a style sheet with a copy of the HTML code we plan to print from the Arduino .... so I am still hoping to find a way to just include an external stylesheet. If not... guess ill just code it into the arduino.
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do the styles work correctly if you save the generated HTML and open the HTML file in a browser? 

If they don't, good for you -- you can debug it with a browser and then back-port the fixes to your Arduino code.

-br
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good freaking call! I had a ....special...moment. First of all, my css was invalid. Funny...I was just testing with body{background:yellow} h1{color:red}

but I haven't done css in a while and spazzed and had put .body and .h1

It works now without the .'s      smiley-grin
Logged

Pages: [1]   Go Up
Jump to: