0
I created a graphic in CSS that works well, but when trying to position it on the page with CSS it goes away.
This is the CSS:
<?php
header("Content-type: text/css");
/*Aqui começa o Gráfico */
$pqtv = 0.75;
$qtv = $pqtv * 100;
$grau = $pqtv * 180;
//linear gradient
$corlinear = "orange";
$corlinearHEX = "102, 102, 102,";
$cordafonte = "orange";
$cordefundo = "#fff";
?>
.quantidades {
float: left;
position: relative;
transform: rotate(<?php echo $grau ?>deg);
background: linear-gradient(0deg, <?php echo $corlinear; ?> 50%, rgba(<?php echo $corlinearHEX; ?> 0.2) 50%); }
.quantidades, .quantidades:before, .quantidades:after {
width: 12rem;
height: 12rem;
border-radius: 50%; }
.quantidades:before, .quantidades:after {
position: absolute;
top: 0;
left: 0;
color: <?php echo $cordafonte; ?>;
text-align: center; }
.quantidades:before {
content: "QTDES";
width: 12rem;
height: 12rem;
background: <?php echo $cordefundo; ?> content-box;
border-radius: 50%;
padding: .5em;
box-sizing: border-box;
font-size: 2rem;
line-height: 8rem;
transform: rotate(-<?php echo $grau ?>deg); }
.quantidades:after {
content: "<?php echo $qtv; ?>%";
line-height: 13rem;
background: linear-gradient(Transparent 50%, <?php echo $cordefundo; ?> 50%);
transform: scale(1.1) rotate(-<?php echo $grau ?>deg);
line-height: 13rem; }
/*Aqui o posicionamento do gráfico na página */
#content1{
background: #e7eef5;
margin-top: 37px;
margin-left:8px;
}
Here the HTML:
<article id="content1">
<div class="quantidades"></div>
</article>
There’s something wrong with this CSS. You haven’t closed the tag PHP before starting with CSS codes and this will generate a syntax error.
– Woss
Failed act Anderson. I edited the question to portray the code
– Webster Moitinho
Now you have PHP code outside the tags PHP. By the way, is PHP really necessary for the question problem? Why not build a [mcve] by just putting the generated CSS?
– Woss
I also recommend that when working with css using php, enable short_open_tag in php.ini (if not enabled), and work with <?= 'x'? > instead of <?php echo 'x' ?>
– Felipe Duarte
I may be wrong because I am a PHP layman, but I think this part can be wrong, no?
content: "<?php echo $qtv; ?>%";
I think this PHP will not work inside the quotes and can generate error.– Leon Freire