如何将文本置于白色中心?

时间:2014-01-04 02:51:23

标签: html css

http://www.solsisters.groupshot.us/slider/index.php

我添加了bodyclass容器,但是我可能把div放在底部错误的位置?

<title>Where in the world is the sun rising and setting right now</title>

<?php 

     $con = mysql_connect("*****","*****","*****");
        if (!$con)
        {
            die('Could not connect: ' . mysql_error());
        }

    mysql_select_db("sunsetimges", $con);
?>
<head>
<title>Where in the world is the sun rising and setting right now</title>
<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" />
<link rel="stylesheet" href="css/flexslider.css" type="text/css" />
<link rel="stylesheet" href="css/style.css" type="text/css" />


<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/all-in-one-min.js"></script>
<script type="text/javascript" src="js/setup.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</head>

 <style type="text/css"> 
body  {
    margin: 0; 
    padding: 0;
    text-align: center;
}
.bodyclass #container { 

    margin: 0 auto;
    text-align: left;
} 
</style>


<img src="a.jpg" height="220px" width="100%" />
<body class="bodyclass ">
<div id="container">

RIGHT NOW UTC: <span id="UTC_za00"></span>
 <?php
date_default_timezone_set("UTC");
$tim= date("H", time()); 

switch ($tim) {
    case 06:
        echo "the sun is RISING in ISTANBUL(above) and SETTING in Landon (below)";
        break;
    case 07:
        echo "the sun is RISING in Tel Aviv(above) and SETTING in Brazil (below)";
        break;
    case 08:
        echo "RISING IN MAURITANIA(above) and SETTING in Bangladesh (below)";
        break;
    case 13:
        echo "Rising in Maine & Boston (above) and SETTING in Denmark (below)";
        break;
    case 14:
        echo " Sun is rising in Minnesota(above) and SETTING in Germany (below).Message to xyz TAKE A SUNSET PHOTO NOW";
        break;
    case 15:
        echo "Sun is rising in Vegas (above) and SETTING in Spain (below)";
        break;
    case 16:
        echo "Sunrise in San Francisco (above) and SETTING in Turkey (below)";
        break;
    case 17:
        echo "Sunrise in Western Canada (above) and SETTING in United states (below)";
        break;
    case 18:
        echo "The sun is RISING in Alaska & Hawaii (above) and SETTING in Switzerland (below), take a SUNSET MATCH NOW!";
        break;
    case 19:
        echo "Sunrise in San RUSSIA (above) and SETTING in Turkey (below)";
        break;
    case 20:
        echo "Sunrise in San Australia (above) and SETTING in India (below)";
        break;
    case 21:
        echo "RISING IN MAURITANIA (above) and SETTING in Egypt (below)";
        break;
    case 22:
        echo "RISING ISTANBUL (above) and SETTING in France (below)";
        break;
    case 23:
        echo "Sunrise in San Tel Aviv (above) and SETTING in Sri Lanka (below)";
        break;
    default :
     echo "RISING IN MAURITANIA(above) and SETTING in Bangladesh (below)";


}
?>

<p>To contribute sunset & sunrise photos to this project and help make a real time match (and make $100), get the <a 

href="https://play.google.com/store/apps/details?id=com.joya.matchthesunset" id="time_is_links">android app</a> or follow us <a 

href="https://twitter.com/2pics1sun" id="time_is_linkss">@2pics1sun</a> on twitter </p>

<script>
time_is_widget.init({
UTC_za00 : {},
New_York_z161 : {
template: "SUN",
sun_format: "srhour:srminute",
coords: "40.71427,-74.00597"
},
Tokyo_z444 : {
coords: "59.33258,18.06490"
}
});
</script>type your content here</div>
</body>

<!-- Slider -->
<div class="bannerbg">
    <div class="container clearfix">

            <div class="flexslider" >
            <ul class="slides">
       <?php $qry="SELECT * from imagepath ORDER BY id DESC LIMIT 1";
             $result=mysql_query($qry);
          while($fetch=mysql_fetch_assoc($result))
          {
        ?>
                <li>
                    <img src="<?php echo $fetch['path']; ?>"  height="360" width="940" alt="" />
                </li>

我们正在使用他们的脚本向您显示当前时间UTC,所以......“找到当前的

Time.is上任何位置或时区的时间!“

           <?php } ?>     

            </ul>
        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:3)

您明确将该文字设置为左对齐。

你有这个CSS:

.bodyclass #container {
    margin: 0 auto;
    text-align: left;
}

将其更改为:

.bodyclass #container {
    margin: 0 auto;
    text-align: center;
}

您的body设置为text-align: center,并且您使用#container上的css覆盖了该text-align。但是,我建议您在特定元素上设置left,而不是width

此外,由于您未在#container上设置margin: 0 auto;,因此不需要{{1}}。