好像我错过了什么,但我还是想不出来.问题是我申请display: none;了#nav-icon.但它仍占用空间.这是我的编码.
HTML
<div id="nav">
<a href="" id="nav-icon"> <img src="navigation.png" alt="nav-menu"</a>
<ul>
<li> <a href="#"> LINK </a> </li>
<li> <a href="#"> LINK </a> </li>
<li> <a href="#"> LINK </a> </li>
<li class="navimage"> <a href="twitter.com"> <img src="twitter-icon.png" alt="twitter-icon" /> </a> </li>
<li class="navimage"> <a href="facebook.com"> <img src="facebook-icon.png" alt="facebook-icon" /> </a> </li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
#nav {
border-bottom:1px solid #FFF;
margin-bottom:20px;
padding:0;
text-align:center;
max-width:95%;
margin:0 auto;
}
#nav li {
display:inline;
}
#nav a {
display:inline-block;
padding:15px;
font-weight:bold; …Run Code Online (Sandbox Code Playgroud) 我创建了一个带有子菜单下拉菜单的菜单。然而,子菜单在更大的屏幕上工作得很好,可以停留在那里而不是向下推,但为了响应,我想要的是子菜单将 div 向下推。下面的代码如下:
.navigationMenu {
clear: both;
width: 100%;
margin: 0 auto;
background-color: #214c21;
}
.navigationMenu ul {
list-style-type: none;
margin: 0;
padding: 0;
position: relative;
cursor: pointer;
}
.navigationMenu ul li {
display: inline-block;
position: relative;
float: left;
margin-right: 1px;
cursor: pointer;
}
.navigationMenu li a {
display: block;
min-width: 140px;
height: 50px;
text-align: center;
line-height: 50px;
color: #fff;
background: #214C21;
text-decoration: none;
}
.navigationMenu li:hover a {
background: #307030;
}
.navigationMenu li:hover ul a {
background: blue;
color: …Run Code Online (Sandbox Code Playgroud)我制作了一个简单的表格来在DataTable中显示 dataTable 类似的内容。问题是我试图以类似的方式来做。
首先,我将代码放在下面:
<table id="myTable" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>$320,800</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>$433,060</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>$103,600</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我不会忘记像这样调用函数:
<script type="text/javascript">
$(document).ready(function(){
$('#myTable').DataTable();
});
</script>
Run Code Online (Sandbox Code Playgroud)
我还按照建议调用了外部资源,如下所示:
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//cdn.datatables.net/1.10.4/js/jquery.data"></script>
Run Code Online (Sandbox Code Playgroud)
我需要一个建议如何将Mon May 12 19:11:38 +0000 2014转换为2分钟前或10分钟前.
我的编码是这样的.
if(isset($tweets->statuses) && is_array($tweets->statuses)) {
if(count($tweets->statuses)) {
foreach($tweets->statuses as $tweet) {
echo "<td>";
echo $tweet->user->screen_name;
echo "</td>";
echo "<td>";
echo $tweet->text;
echo "</td>";
echo "<td>";
echo $tweet->created_at;
echo "</td>";
echo "</tr>";
Run Code Online (Sandbox Code Playgroud)
我已经实现了这样的东西,我想挖掘created_at它,因为它看起来有点奇怪.无论如何,我发现了许多像这样的来源.但那个不是我想要的.我要的是,使之出现像2 days ago,10 days ago,yesterday.任何的想法?