Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert CSS to inline CSS?

I found this awesome CSS code and what to use it on my website. But because I have to generate a lot of buttons with PHP I need to write the CSS inline as style="..." for the button. My question now is, how can I convert that to inline CSS?

I already googled for an converter but sadly I didn't find anything.

like image 483
ChantelleWedel Avatar asked Jun 07 '26 14:06

ChantelleWedel


2 Answers

You could put it at the top of your file surrounded by style tags.

It would then affect just that file given the associated classes were on the elements meant to be affected.

<style>
//css code goes here
</style>

EDIT:

If you specifically want it to be inline and dont want to type it manually then you would either have to find or write a tool that will add run a post process on it. Writing this correctly would be a challenge but Gulp might be your friend.

like image 62
rjustin Avatar answered Jun 09 '26 03:06

rjustin


are you looking for something like this?

<button style="background: blue; color: black; font-size: 15px">Im a button</button>
like image 37
Jasper Jalago Avatar answered Jun 09 '26 05:06

Jasper Jalago



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!