rosefrost Posted February 29, 2020 Share Posted February 29, 2020 hey guys, I am wondering how to style the below code snippet using css? the code itself is working - i just am trying to figure out how to style it :( <div class="section"> <?php if(isset($_SESSION['uid'])) { echo 'Hello,'; echo $_SESSION["uid"]; } ?> </div> Quote Link to comment https://forums.phpfreaks.com/topic/310161-styling-within-php-tags/ Share on other sites More sharing options...
gw1500se Posted February 29, 2020 Share Posted February 29, 2020 <div class="section" style="<whatever css style you want>"> <?php if(isset($_SESSION['uid'])) { echo 'Hello,'; echo $_SESSION["uid"]; } ?> </div> 1 Quote Link to comment https://forums.phpfreaks.com/topic/310161-styling-within-php-tags/#findComment-1574999 Share on other sites More sharing options...
rosefrost Posted February 29, 2020 Author Share Posted February 29, 2020 thanks gw1500se! Quote Link to comment https://forums.phpfreaks.com/topic/310161-styling-within-php-tags/#findComment-1575000 Share on other sites More sharing options...
ginerjm Posted February 29, 2020 Share Posted February 29, 2020 The better way to "style HTML tags" (not php ones) is to use formal css code placed into the HTML <style> tag section of your html code. That way you don't have to place attributes into multiple places in your html. You can style similar things by defining CSS code for a tag name (ie, td, tr, p, span, whatever) and then referencing that css id name like this: in the head tag section add <style type='text/css'> #style1 { padding: 4px 6px; margin:1%; } and then in the html: <div id='style1'> 1 Quote Link to comment https://forums.phpfreaks.com/topic/310161-styling-within-php-tags/#findComment-1575001 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.