我想在这个php echo中添加一个右浮动样式。
<?php echo $PAGE->button; ?>
<?php } ?>
<div class="foo">
<?php echo $PAGE->button; ?>
<?php } ?>
</div>
在CSS中:
.foo {
/* some styles here */
}
<?php echo "<div style='float: right;'>". $PAGE->button ."</div>"; ?>
<?php echo "<div style=\"float:right;\">" . $PAGE->button . "</div>"; ?>
<?php } ?>
这将把整个按钮浮动到右侧
你不能直接给echo函数添加样式。但是你可以将其包装在标签、p或任何其他HTML标记中,并在样式中使用float: right。
就像这样,
<p style="float: right;"><?php echo $PAGE->button.?></p>
echo '';
或 echo ('');
或 echo '','','',''
或 echo ''.''.''.''
。 - Lawrence Cherone<?php echo "<div style='float: right;'>". $PAGE->button ."</div>"; ?>
<div style="float: right;"><?php echo $PAGE->button; ?></div>
你有几个选项,首选方法是在CSS文件中定义按钮的值:
或者在头部使用样式表:
或者您可以使用内联样式。
<style>
.button{
float:right;
}
</style>
<!--Using the button class from the stylesheet, Notice how many less characters there is-->
<input type="button" value="Button" class="button" name="B3">
<br />
<!--Using the same class from the stylesheet, but wrapping the button within a span-->
<span class="button"><input type="button" value="Button" name="B3"></span>
<br />
<!--The inline method-->
<span style="float:right"><input type="button" value="Button" name="B3"></span>