That my first post here.
I’m a self-taught developer and I’d really like to learn how to put an image in the background of a search bar.
I can imagine that HTML isn’t suitable, but I don’t know CSS very well.
As this MND course* on CSS suggests, we can embed pre-defined text in what I call the "dialog box" of the search bar box.
I’m pretty sure it’s possible to embed a background image in this search bar ( either in .PNG or .SVG format, but I’d prefer to use the vector format if possible ).
But as for the "variable", "attribute" or "property", I don’t know which to use or how to formulate it in my code to make it work.
*https://developer.mozilla.org/fr/docs/Web/HTML/Element/input/search
I don’t have the code acec me at the moment but from memory I had something like this in my CSS :
.image-searchbar{
to get the URL of the image I stored it on a server and retrieved the link that belongs to it.
I’ll update this post as soon as I get my code back.
2
Answers
Simple with:
like so:
.search-bar {
background-image: url(‘path to your image’);