News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Color Of User Information

Started by briannnn, March 09, 2012, 12:47:39 AM

Previous topic - Next topic

briannnn

Hey, I am trying to make it so user information like post count, rep, date registered, ect next to topic is a certain color for certain member groups. I am a Java coder not HTML coder but is there an HTML code for like

if(membergroup == 1);
color: #111111
}


Note: I know where to change code for this but I just need help with doing this kind of html code.

Luis-

That isn't HTML, that's PHP. And it would be;
if(membergroup == 1) {
echo '<font color="111111"></font>';
}

Something like that.

IchBin™

Better to use a tag that is not deprecated. <font> has long been replaced with color in styles. Use a span and put the color into the style tag instead.

If it were me and I was trying to do this, I'd use some PHP to change the class.

if (membergroup == 1)
    $mystyle = 'mem1';
else if (membergroup ==2)
    $mystyle = 'mem2';
else
    $mystyle = 'default';


Then:
echo '<span class="' , $mystyle ,'">Stuff here</span>';

Then you can define all those classes in your css file.
IchBin™        TinyPortal

briannnn

Is there way to do this right in my index.css because I can change the color of post count by change this
.poster li.stars, .poster li.avatar, .poster li.blurb, li.postcount, li.im_icons ul
{
margin-top: 0.5em;

}

to
.poster li.stars, .poster li.avatar, .poster li.blurb, li.postcount, li.im_icons ul
{
margin-top: 0.5em;
        color: #452532;

}


But can I add like a if(....) then .... statement right in the index.css file or no.
Heres example.
.poster li.stars, .poster li.avatar, .poster li.blurb, li.postcount, li.im_icons ul
{
margin-top: 0.5em;
if(membergroup == 1);
        color: #111111;
}


}

Eudemon

no you can't add an if statement or any other programming language related statements in a css file
correct me if i am wrong

briannnn

Well damn lol. So first where do I put the if statement listed above and how do I string it to index.css in theme file. Do I use like a boolean or something if there even is that in php or html.


Illori

briannnn please do not bump within 24 hours we are all volunteers and reply if and when we know the answer

briannnn

Dude I waited 21 hours not a big deal but alrighty I will wait 24 hours from now on.

Eudemon

the best thing you can do is make bunch classes in your css file
and use ichbin's suggestion

Luis-

Quote from: IchBin™ on March 09, 2012, 03:39:30 PM
Better to use a tag that is not deprecated. <font> has long been replaced with color in styles. Use a span and put the color into the style tag instead.

If it were me and I was trying to do this, I'd use some PHP to change the class.

if (membergroup == 1)
    $mystyle = 'mem1';
else if (membergroup ==2)
    $mystyle = 'mem2';
else
    $mystyle = 'default';


Then:
echo '<span class="' , $mystyle ,'">Stuff here</span>';

Then you can define all those classes in your css file.
Ah! I see.

Advertisement: