0

http://www.youngcreativity.se

你可以确定它是一个新闻提要。

当用户上传新闻时,是否有可能所有文本/新闻都像圆角框一样显示?该框应在提要中有多少新闻后自动调整大小。php 代码如下所示。

<!DOCTYPE html>
<html lang='en'>
<head>
<style type="text/css">

#boxID{
border:2px solid;
border-radius:25px;
width:auto; 
height:auto;
}


element {
color: black;
}




body {


-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-attachment: fixed;
background-image: url(bgn1.png);
background-repeat: no-repeat;
background-position: center top;
}
.news {
font-family: Rough_Typewriter;
font-size: 36px;
}
</style>

<meta charset="UTF-8">
<title>iWrite</title>
<meta name="view" content="width-device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="keywords" content="">

<link href="css/bootstrap.css" rel="stylesheet">


</head>
<h1 class="news">iWrite</h1>
<p>
<hr>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<a href='post.php'>Want to post a text?</a>
<?php

//connect

mysql_connect("server","username","password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());

//query the database
$getnews = mysql_query("SELECT * FROM news ORDER BY id DESC") or die(mysql_query());

while ($row = mysql_fetch_assoc($getnews))
{

//get data
$id = $row['id'];
$title = $row['title'];
$body = $row['body'];
$date = $row['date'];

echo "
<b>$title posted on $date</b><br>
";

echo nl2br($body);

echo "<hr>
";

}

mysql_real_escape_string();



?>

</hr></html>
4

1 回答 1

1

您可以将 CSS 半径添加到您的 Div/类:

{
border:2px solid;
border-radius:25px;
}

您可以通过将其放入您的 css 类/id 中来使用它:

#boxID{
border:2px solid;
border-radius:25px;
}

<div id="boxID"></div>

或者你可以根本不使用 CSS 类/ID(这并不酷):

<div id="boxID" style="border:2px solid; border-radius:25px;"></div>

编辑:

好的,要拥有一个大圆形框,请执行以下操作:

<!DOCTYPE html>
<html lang='en'>
<head>
<style type="text/css">

#boxID{
border:2px solid;
border-radius:25px;
width:auto; 
height:auto;
}


element {
color: black;
}




body {


-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-attachment: fixed;
background-image: url(bgn1.png);
background-repeat: no-repeat;
background-position: center top;
 text-align: center;
}
.news {
font-family: Rough_Typewriter;
font-size: 36px;
}
.bigBox{

border:2px solid white;
border-radius:10px;
}
</style>

<meta charset="UTF-8">
<title>iWrite</title>
<meta name="view" content="width-device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="keywords" content="">

<link href="css/bootstrap.css" rel="stylesheet">


</head>
<div class="bigBox">
<h1 class="news">iWrite</h1>
<p>
<hr>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<a href='post.php'>Want to post a text?</a>
<?php

//connect

mysql_connect("server","username","password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());

//query the database
$getnews = mysql_query("SELECT * FROM news ORDER BY id DESC") or die(mysql_query());

while ($row = mysql_fetch_assoc($getnews))
{

//get data
$id = $row['id'];
    $title = htmlspecialchars(strip_tags($row['title'])); 
$body = htmlspecialchars(strip_tags($row['body']));
$date = $row['date'];

echo "
<b>$title posted on $date</b><br>
";

echo nl2br($body);

echo "<hr>
";

}





?>

</hr>
</div></html>

试试看。

于 2012-05-17T10:11:26.417 回答