|
Forum Index : Microcontroller and PC projects : I need html help
| Author | Message | ||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1053 |
I cannot get a background jpg file or color to appear on a simple web page set up on the a: drive of the pico webmite (MM.VER=6.0201). I can LOAD JPG to the LCD screen so I am sure the filename and data are correct. Here is some code: <html> <head> <title>WEBMITE TEST PAGE</title> <style> body{ background_color: #F4F4F4; background-image: url('A:/VanRear.jpg'); } </style> </head> <body> <h1>HEADER 1<h1> </body> </html> Hopefully some one can see the errors of my ways. OA47 |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11967 |
Manual page 97 |
||||
| maxwelloau Newbie Joined: 31/10/2025 Location: AustraliaPosts: 7 |
The CSS is close, but background_color isn’t a valid CSS property—it should be background-color. Also, A:/VanRear.jpg is a local drive path, so it likely won’t load for anyone else viewing the site. Put the image in your project and use a relative path: body { background-color: #f4f4f4; background-image: url("images/VanRear.jpg"); } Adjust images/VanRear.jpg to match the image’s location in your project. ----------------------------------------------------------- I don't claim to know this, I just asked the automatic helper. 20 years ago I did some Html, all forgotten! |
||||
| Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5199 |
The "A:/VanRear.jpg" is not a valid url from the browsers perspective. OK, I haven't played with the web mite to really know, but on a web server, to send a file thats not in the web folder folder ( htdocs, wwwroot, etc ), you set up a virtual folder in the web server config, so in your case 'A:\' would be aliased as \htdocs\A. Then background-image: url('/A/VanRear.jpg'); would work. The other option is to convert the image into base64 and embed it into the page. eg <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QLcRXhpZgAATU0AKgAAAAgABAE7AAIAAAAGAAABSodp AAQAAAABAAABUJydAAEAAAAMAAACyOocAAcAAAEMAAAAPgAAAAAc6gAAAAEAAAAAAAAAAAAA etc lots of times tPFFFeWz0kOFU9VvJbO1Dw7dxOMkZxRRRD4kKXws5mWaSeTfM5dj3Jph60UV7K0R5T3G0hoo qhBSUUUxCGk7UUUxDaKKKYCUlFFAhDRRRVCG9qKKKYhKSiimIQ9aSiigBKQ0UVQgNJRRQhCG kNFFMQlFFFMD/9k=" width="820" height="100" border="1"> In a style, that would be... background-image: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ...'); Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1053 |
Peter, am I to assume from your reply that what I am trying to do is not possible? I have been able to pass variable and operations to and from the MMBasic program but thought I might be able to enhance the presentation of the data. @maxwellaou, I did try to move the .jpg file to a /images subdirectory but still nogo. @Glenn you went way over my head with the base64 example but thankyou to all for the responses. OA47 |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11967 |
You just need to double the opening curly bracket as per the manual entry |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |