このphpエコーにfloatrightスタイルを追加したい
<?php echo $PAGE->button; ?>
<?php } ?>
HTMLの場合:
<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 } ?>
これにより、ボタン全体が右に浮きます
いくつかのオプションがあります。推奨される方法は、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>
<?php echo "<div style='float: right;'>". $PAGE->button ."</div>"; ?>
エコー機能にスタイルを与えることはできません。ただし、lable、p、またはその他のhtmlタグでラップして、float:をスタイリッシュに指定できます。
このような、
<p style="float: right;"><?php echo $PAGE->button.?></p>
よりクリーンな方法でそれを行う:
<div style="float: right;"><?php echo $PAGE->button; ?></div>