I'm doing a profile for this website, and I wanted to do a cover photo like element like facebook has. The problem I have ran into is, first how do I save the background image of the cover? Like, I can save the url of the image in the database, but how would I possibly be able to put it in css?
I do not really want to just put:
<div style="background-image:url(<?php echo $imageUrl?>) no-repeat center center fixed">
</div>
That looks really ugly markup. Is there some other way?
The only other options would be to put it in a style tag, or have php generate an external CSS file.
For the tag you'd do
<style>
div { background-image: url(<?php echo $imageURL;?>); }
</style>
That is a bit cleaner than inline HTML styling.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With