【问题标题】:styling and positioning string of php with css使用 css 的 php 的样式和定位字符串
【发布时间】:2013-06-27 00:10:41
【问题描述】:

我想知道如何使用 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 字体设计 $username。 :)

【问题讨论】:

  • 您在 html 中设置表单的样式,而不是 php 代码。

标签: php css string styles location


【解决方案1】:

您需要将带有适当&lt;link&gt; 的 HTML 输出到您的 CSS。

对于示例

<?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;
?>

【讨论】:

    猜你喜欢
    • 2011-01-21
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-23
    • 2017-12-31
    相关资源
    最近更新 更多