HTML对齐说明
此函数用于显示用户图片(user.jpg)和用户配置文件描述(stripslashes($row[1]) 现在,图片位于用户配置文件描述的左侧 如何使用户的配置文件描述显示在图片下方HTML对齐说明,html,css,Html,Css,此函数用于显示用户图片(user.jpg)和用户配置文件描述(stripslashes($row[1]) 现在,图片位于用户配置文件描述的左侧 如何使用户的配置文件描述显示在图片下方 function showProfile($user) { if (file_exists("$user.jpg")) echo "<img src='{$user}.jpg?".time()."' align='left' />"; $result = queryMy
function showProfile($user)
{
if (file_exists("$user.jpg"))
echo "<img src='{$user}.jpg?".time()."' align='left' />";
$result = queryMysql("SELECT * FROM profiles WHERE user='$user'");
if (mysql_num_rows($result))
{
$row = mysql_fetch_row($result);
echo stripslashes($row[1]) . "<br clear=both /><br />";
}
}
您可以在中使用style=“float:left;clear:both;”“
”;
$result=queryMysql(“从配置文件中选择*,其中用户='$user'”);
if(mysql_num_行($result))
{
$row=mysql\u fetch\u row($result);
回音条斜线($row[1])。“
”;
}
}
您能将所有内容都包装在div中并相应地设置样式吗?因为这不是php问题,请显示生成的html和css。有几十种可能的解决方案,但在这种情况下,如果看不到至少一些html和css,就无法确定哪种解决方案是正确的。上的clear=两者都
>br
标记建议所有类型的浮动元素,因此我们需要该上下文。这仅在img
是浮动块元素时才起作用。默认情况下不是这样。@GolezTrol啊,说得好。更新的答案。这应该也适用于内联块
等待空白
声明,无论是指定的还是b是的,谢谢!
/* styles.css */
* {
font-family:verdana,sans-serif;
font-size :14pt; }
body {
width :700px;
background:#fff;
}
html {
background:#fff }
img {
border :1px solid black;
margin-bottom :50px;
margin-right :15px;
-moz-box-shadow :2px 2px 2px #888;
-webkit-box-shadow:2px 2px 2px #888;
box-shadow :2px 2px 2px #888; }
li a, .button{
text-decoration:none; }
li a:hover, .button:hover {
color:green; }
.appname {
text-align :center;
background :#c4c4c4;
color :#40d;
font-family:helvetica;
font-size :20pt;
padding :4px; }
.fieldname {
float:left;
width:120px; }
.main {
margin-left:40px; }
.info {
background :lightgreen;
color :blue;
border :1px solid green;
padding :5px 10px;
margin-left:40px; }
.menu li, .button {
display :inline;
padding :4px 6px;
border :1px solid #777;
background :#ddd;
color :#d04;
margin-right :8px;
border-radius :5px;
-moz-box-shadow :2px 2px 2px #888;
-webkit-box-shadow:2px 2px 2px #888;
box-shadow :2px 2px 2px #888; }
.subhead {
font-weight:bold; }
.taken, .error {
color:red; }
.available {
color:green; }
.whisper {
font-style:italic;
color :#006600; }
function showProfile($user)
{
if (file_exists("$user.jpg"))
echo "<img src='{$user}.jpg?".time()."' style='float:left;clear:both;' />";
$result = queryMysql("SELECT * FROM profiles WHERE user='$user'");
if (mysql_num_rows($result))
{
$row = mysql_fetch_row($result);
echo stripslashes($row[1]) . "<br clear=both /><br />";
}
}