使用css对php字符串进行样式化和定位


styling and positioning string of php with css

我想知道如何使用css定位php来源的字符串,我在登录后制作了一个登录表单,用户被引导到一个仪表板,我想在那里查看他们在特定位置的用户名,

这是我的代码:

CSS

// font to decorate the username string
@font-face {
    font-family: 'chunkfiveroman';
    src: url('chunkroman/chunkfive-webfont.eot');
    src: url('chunkroman/chunkfive-webfont.eot?#iefix') format('embedded-opentype'),
         url('chunkroman/chunkfive-webfont.woff') format('woff'),
         url('chunkroman/chunkfive-webfont.ttf') format('truetype'),
         url('chunkroman/chunkfive-webfont.svg#chunkfiveroman') format('svg');
    font-weight: normal;
    font-style: normal;
}
#postioner
{
position:absolute;
left:100px;
top:100px;
}

PHP

<?php
session_start();
$_SESSION['var'] = $username;
?>

我也想知道如何使用css字体stlye $username。:)

您需要向CSS输出带有适当<link>的HTML。

对于示例

<?php
$username = 'Bob';
echo <<<EOT
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>My Title</title>
    <link rel="stylesheet" href="mystyles.css">
</head>
<body>
$username
</body>
EOT;
?>