0
$a = "ABCD";

?>
    <link rel='stylesheet' type='text/css' href='others.php' />
    <style>
        .page-title {
            text-indent: -9999px;
            line-height: 0;
        }
        .page-title:after {
            content: <?php echo $a; ?>;
        }
    </style>
<?php
  • It's a .php file and I need to pass "ABCD" to the content of the CSS as above.
  • I don't want to keep an extra .php or .css file.

1 Answer 1

2

The value of the content style needs to be in quotes, unless it's one of the special keywords.

$a = "ABCD";

?>
    <link rel='stylesheet' type='text/css' href='others.php' />
    <style>
        .page-title {
            text-indent: -9999px;
            line-height: 0;
        }
        .page-title:after {
            content: "<?php echo $a; ?>";
        }
    </style>
<?php
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.