我想要对齐我的文本,以便当我发送消息时,它出现在左边,但它是回复,文本出现在右边…我不知道是使用"text- align :left",定位还是对齐。以下是我的代码
if ($row['username'] == $username)
{
$color = 'blue';
$align:left; // dont know if this is right
}
else
{
$color = 'red';
$align:right; // dont know if this is right
}
echo '<i><p style="font-family:arial;color:'.$color.';font-size:15px;"> <strong>' . $row['username']. '</strong>: ' . $mymessage.'</i></p>';
}发布于 2013-06-11 22:40:30
尝尝这个,
$css = ($row['username'] == $username) ? 'color:blue;text-align:left;' : 'color:red;text-align:right;';
echo '<i><p style="font-family:arial;font-size:15px;'.$css.'"> <strong>' . $row['username']. '</strong>: ' . $mymessage.'</i></p>';https://stackoverflow.com/questions/15368883
复制相似问题