Use css file in a php document

0

You see, I'm doing some php pages that simulate the management of hotel reservations. To style the page, I'm using a css document.

What you put in body affects the entire php page. What you put in form, to the forms only. The question is how to put sentences that affect what is in <?php ?> . I tried with php{} , but it does not work. I also fail ?php{}

Edit: I found a fudge.

I call it botched because I will have to put this in each php, but it seems that there is no way to directly request a css that acts on a php.

    
asked by Miguel Alparez 22.11.2017 в 15:06
source

2 answers

0

For this you should create with a container when you print the data that you bring from PHP and give the styles to that container.

<?php 
    echo '<div class="contenedor_php"><p>Contenido traído por php</p></div>';
?>

And in your css file:

.contenedor_php{
    /*Estilos relacionados*/
}
    
answered by 22.11.2017 в 15:13
0

I already discovered how to solve it. I can not put a css code that points to php, but if I put a label that addresses the php fragment, it will also affect what is inside the code.

That is, if I have a css:

p{
// Código
}

And then I do in the other file:

<p>
<?php
// Instrucciones
?>
</p>

Well, what you have for 'p' will also affect PHP.

    
answered by 23.11.2017 в 20:19