我是关于css的新手(因为你可以看到我的网页有多糟糕),而且我有问题将一些内容放在页面的中心顶部。在我的网页中我也使用bootstrap,因为很多人告诉我它更容易创建好的CSS。该页面是CodeIgniter项目的View
,因此,您会看到一些Php
代码:
Home_view.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link rel="stylesheet" src="http://fancyapps.com/fancybox/source/jquery.fancybox.css"></script>
<script type="text/javascript" src="<?php echo base_url('/Fancybox/source/jquery.fancybox.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('/Fancybox/lib/jquery.mousewheel-3.0.6.pack.js'); ?>"></script>
<title>Private Area</title>
<link rel="stylesheet" href="<?php echo base_url('home_view_style.css');?>">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4" style="background-color:lavender;">
<img src="<?php echo base_url('Immagini/icon-prof.png'); ?>">
<h4>Benvenuto <!-- <?php echo $username; ?> --> </h4>
<a href="home/logout">Logout</a>
<a class="fancybox" data-fancybox-type="iframe" rel="group" href="http://www.istruzioneformazionelavoro.it/Engine/RAServeFile.php/f/corsi/84/Tabella_corsi_allegatoDD311.pdf">prova</a>
</div>
</div>
</div>
<div id="loader" style="margin-left: 300px;">
<div class="loader">
<?php echo form_open_multipart('materiale/inserisci');?>
<input type="file" name="userfile" size="20" />
<br />
<form class="form-inline">
<div class="form-group">
Nome<input type="text" class="form-control" name="Nome" size="20" />
</div>
<br />
<div class="form-group">
Descrizione<input type="text" class="form-control" name="Descrizione" size="20" />
</div>
<br />
<label for="tipo_libro"><input id="tipo_libro" type="radio" name="tipo" value="libro" checked/>Libro</label>
<br/>
<label for="tipo_guide"><input id="tipo_guide" type="radio" name="tipo" value="guide"/>Guida</label>
<br/>
<label for="tipo_video"><input id="tipo_video" type="radio" name="tipo" value="video"/>Video</label>
<br/>
<label for="tipo_animazioni"><input id="tipo_animazioni" type="radio" name="tipo" value="animazioni"/>Animazioni</label>
<br/>
<label for="tipo_registrazioni"><input id="tipo_registrazioni" type="radio" name="tipo" value="registrazioni"/>Registrazioni</label>
<br/>
<input type="submit" class="btn" value="Carica" />
<br/>
<br/>
<br/>
<br/>
</form>
<div>
<h3><span class="label label-success">Libri</span> </h3>
<?php
echo "<table>";
echo "<tbody>";
echo "</br>";
foreach ($libri as $row):
?>
<tr>
<td>
<div>
</br>
<img src="<?php echo base_url('Immagini/book.png'); ?>" />
<a href="<?php echo base_url($row['Url_suffix']) ?>"><?php echo $row['nome']; ?> </a>
<a href="<?php echo site_url('libro/elimina/'.$row['ID']) ?>"><img src="<?php echo base_url('Immagini/button_close.png'); ?>"/></a>
</div>
</td>
</tr>
<?php
endforeach;
?>
<?php
echo "</tbody>";
echo "</table>";
?>
</div>
</br>
</br>
<div>
<h3><span class="label label-success">Guide</span> </h3>
<?php
echo "<table>";
echo "<tbody>";
echo "</br>";
foreach ($guide as $row):
?>
<tr>
<td>
<div>
</br>
<img src="<?php echo base_url('Immagini/guide.png'); ?>" />
<a href="<?php echo base_url('Uploads/10.pdf') ?>"><?php echo $row['nome']; ?> </a>
<a href="<?php echo site_url('guida/elimina/'.$row['ID']) ?>"><img src="<?php echo base_url('Immagini/button_close.png'); ?>"/></a>
</div>
</td>
</tr>
<?php
endforeach;
?>
<?php
echo "</tbody>";
echo "</table>";
?>
</div>
</br>
</br>
<div>
<h3><span class="label label-success">Video</span> </h3>
<?php
echo "<table>";
echo "<tbody>";
echo "</br>";
foreach ($video as $row):
?>
<tr>
<td>
<div>
</br>
<img src="<?php echo base_url('Immagini/video.png'); ?>" />
<a href="<?php echo base_url('Uploads/10.pdf') ?>"><?php echo $row['nome']; ?> </a>
<a href="<?php echo site_url('Video_c/elimina/'.$row['ID']) ?>"><img src="<?php echo base_url('Immagini/button_close.png'); ?>"/></a>
</div>
</td>
</tr>
<?php
endforeach;
?>
<?php
echo "</tbody>";
echo "</table>";
?>
</div>
</br>
</br>
<div>
<h3><span class="label label-success">Animazioni</span></h3>
<?php
echo "<table>";
echo "<tbody>";
echo "</br>";
foreach ($animazioni as $row):
?>
<tr>
<td>
<div>
</br>
<img src="<?php echo base_url('Immagini/animazioni.png'); ?>" />
<a href="<?php echo base_url('Uploads/10.pdf') ?>"><?php echo $row['nome']; ?> </a>
<a href="<?php echo site_url('animazione/elimina/'.$row['ID']) ?>"><img src="<?php echo base_url('Immagini/button_close.png'); ?>"/></a>
</div>
</td>
</tr>
<?php
endforeach;
?>
<?php
echo "</tbody>";
echo "</table>";
?>
</div>
</br>
</br>
<div>
<h3><span class="label label-success">Registrazioni</span> </h3>
<?php
echo "<table>";
echo "<tbody>";
echo "</br>";
foreach ($registrazioni as $row):
?>
<tr>
<td>
<div>
<img src="<?php echo base_url('immagini/video.png'); ?>" />
<a href="<?php echo base_url('Uploads/10.pdf') ?>"><?php echo $row['nome']; ?> </a>
<a href="<?php echo site_url('registrazione/elimina/'.$row['ID']) ?>"><img src="<?php echo base_url('Immagini/button_close.png'); ?>"/></a>
</div>
</td>
</tr>
<?php
endforeach;
?>
<?php
echo "</tbody>";
echo "</table>";
?>
</div>
</br>
</br>
<div>
</div>
</div>
</div> <!-- end #container-->
</body>
</html>
我尝试了很多方法,比如我试过这个:
#top {
position: fixed;
top: 0;
left: 0;
z-index: 999;
width: 100%;
height: 23px;
text-align:center;
}
并使用div
,但遗憾的是没有结果。我要求耐心,因为我是css的新手,我很难理解。最后,如果有人能给我美学建议,我会很高兴,这样我就会成长得更多。
更新2:
home_view_style.css
* {
box-sizing: border-box
}
html,
body {
margin: 0;
padding: 0;
}
body {
background-image: url("immagini/Opedia_lab_Logged.png");
background-size: cover;
font-family: "Trebuchet MS",Arial;
font-size: 14px;
}
.btn {
color: #fff;
background-color: #84ae6a;
border-color: #84ae6a;
position:absolute; // absolutely positioned
right: 100%;
}
a{
text-decoration: none;
}
#log {
margin: 60px 0px 0px 0px;
}
#log {
margin-top: 80px;
}
#log {
margin: 20px;
background: rgba(90,90,90,0.1);
border-radius: 20px;
padding: 20px;
text-align: center;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#side-nav {
padding: 20px 40px;
}
#viewport.open #side-nav, #side-nav {
width: 25%;
left: 0px;
}
#side-nav {
width: 40%;
left: -40%;
}
#side-nav {
width: 80%;
left: -80%;
-webkit-transition: 0.5s cubic-bezier(0.190,1.000,0.220,1.000);
transition: 0.5s cubic-bezier(0.190,1.000,0.220,1.000);
}
#side-nav {
position: absolute;
min-height: 100%;
top: 0px;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#loader{
position: absolute;
top: 0;
left: 35%;
width: 30%;
text-align: center;
font: 14px ,Arial;
color: #5C5C5C;
background: #F2FFED;
padding: 10px;
}
/*.container {
width: 100%;
height: 300px;
background-color: rgba(255, 255, 255, .5);
position: absolute;
top: 20%;
left: 50%;
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
*/
/*
.container {
width: 100%;
height: 300px;
background-color: rgba(255, 255, 255, .5);
position: absolute;
top: 20%;
left: 50%;
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.inputs {
position: absolute;
top: 75%;
left: 50%;
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.input.submit {
position: absolute;
top: 75%;
right: 70%;
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
*/