2
Generally speaking, how to change the CSS property of a tag depending on the user’s access to the system?
Below is the header image (draft) before the user access the system:
And below the same header, but with the Ivs of the buttons misaligned (disregard the exaggerated size of the user name):
And below are the codes of the two:
<div class="header">
<h1 style="margin-left: 300px; margin-top: 0px;"><a href="index.php">TI_sem_dúvidas</a></h1>
<div class="btn_login" style="margin-left: 1000px; margin-top: 50px;">
<a href="#abrir-modal">Login</a>
</div>
Above was the header before login.
Below is the after.
<div class="header">
<h1 style="margin-left: 300px; margin-top: 0px;"><a href="index.php">TI_sem_dúvidas</a></h1>
<div class="btn_login" style="margin-left: 800px; margin-top: 50px; background-color: steelblue; width: 300px;">
Nome de Usuário
</div>
<div class="btn_login" style="margin-left: 1000px; margin-top: 50px;">
<a href="#abrir-modal">Sair</a>
</div>
</div>
Below is the css of HTML and body
html{
position: relative;
min-height: 100%;
background-color: lightblue;
}
body{
font-family: verdana;
margin: 0 0 400px; /* bottom = footer height */
}
The headers have the extension html.php
.
I’m not sure I understand, but this is not the case
if( ... ) else
?– Papa Charlie
@Papacharlie you say put php if Else inside HTML or CSS? I ask because I asked this question http://answall.com/questions/65104/como-modifir-com-segurn%C3%A7a-a-file-css-using-php (still unanswered) and I felt insecure the use of php within CSS, because of an answer I saw in Soen...
– gustavox
If I understand correctly, you want to load a new style sheet according to a user’s authentication (i.e., someone 'logged in' and so changes the CSS), correct? If yes, I think if you increment an HTML by PHP (a
echo
of HTML content) that has a Javascript script to change the style of the required elements will solve your problem. And if it’s Ajax authentication, it’s even easier! Just insert more line of Javascript code into the function call! :)– José