wixil Posted June 1, 2022 Share Posted June 1, 2022 <td><img src="<?php echo $item["image"]; ?>" class="cart-item-image" /><?php echo $item["name"]; ?></td> how do i apply style="text-align:left; font-size:12px; font-family:TimeBurner; to the echo $item["name"]..... above to look like the below image Quote Link to comment https://forums.phpfreaks.com/topic/314877-applying-inline-css-to-php-echo/ Share on other sites More sharing options...
benanamen Posted June 1, 2022 Share Posted June 1, 2022 All that styling markup does no belong mixed in HTML. Create a proper style-sheet. Quote Link to comment https://forums.phpfreaks.com/topic/314877-applying-inline-css-to-php-echo/#findComment-1596927 Share on other sites More sharing options...
schwim Posted June 1, 2022 Share Posted June 1, 2022 (edited) <td><img src="<?php echo $item["image"]; ?>" style="text-align:left; font-size:12px; font-family:TimeBurner;" class="cart-item-image" /><?php echo $item["name"]; ?></td> @benanamen is absolutely correct that your styles don't belong inline but I often do testing inline before moving it to my css file. If you're trying to add the style to your image, that's how you'd do it. Edited June 2, 2022 by cyberRobot Added missing quote for the style attribute 1 Quote Link to comment https://forums.phpfreaks.com/topic/314877-applying-inline-css-to-php-echo/#findComment-1596934 Share on other sites More sharing options...
gizmola Posted June 1, 2022 Share Posted June 1, 2022 An inline style should be the last resort. Why are you looking at doing that rather than using css classes? Quote Link to comment https://forums.phpfreaks.com/topic/314877-applying-inline-css-to-php-echo/#findComment-1596938 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.