Go Down

Topic: CSS sheet via println? (Read 590 times) previous topic - next topic

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: [Select]
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: [Select]
<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>

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.

billroy

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

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      :D

Go Up