I found solution on how to add <style> tag to page layout – with use of CustomString addon. This is described in topic https://forum.mendix.com/link/questions/101948.
My classContainer widget allows you to dynamically determine classes or styles based on your data. Download this mpk file, drop it in your /widgets/ folder, and press F4 in Studio Pro. Then you can add it on your pages, and put content inside of it.
Or use the Dynamic Class widget from the app store: https://appstore.home.mendix.com/link/app/108838/