Css Archives | Page 3 of 4 | Codeexecute

Masonry Infinite Scroll With Mysql

<?php
ob_start();
$aHost = 'HOSTNAME';
$aUser = 'DBUSER';
$aPass = 'DBPASS';
$aDb   = 'DBNAME';
$aCon  = mysqli_connect($aHost,$aUser,$aPass);
mysqli_select_db($aCon,$aDb);


$limit = 15;
$page  = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
$start = ($page - 1) * $limit;

$aLimit = "LIMIT {$start},{$limit}";
$aSql = "SELECT * FROM wp_posts WHERE 1 {$aLimit}";
$aResult = mysqli_query($aCon,$aSql);

?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Infinite Scroll With Mysql</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div id="gridConainer" class="">
<?php
	while($aRow = mysqli_fetch_assoc($aResult))
	{
	?>
		<div class="box">
			<h1><?php echo $aRow['post_title']; ?></h1>
			<h2><?php echo date("d/m/Y",strtotime($aRow['post_date'])); ?></h2>
			<p><?php echo $aRow['post_name']; ?></p> 
		</div>
	<?php
	}
?>
</div>
<nav id="page-nav">
  <a href="index.php?page=<?php echo $page; ?>"></a>
</nav>	

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/jquery.masonry.min.js"></script>
<script src="js/jquery.infinitescroll.min.js"></script>
<script>
$(function(){

	var $container = $('#gridConainer');
		
	$container.imagesLoaded(function(){
		$container.masonry({
			itemSelector: '.box',
		});
	});
	
	$container.infinitescroll({
	navSelector  : '#page-nav',    
	nextSelector : '#page-nav a', 
	itemSelector : '.box',     
	loading: {
	finishedMsg: 'No more pages to load.',
	img: 'http://i.imgur.com/6RMhx.gif'
	}
	},	
	function( newElements ) {
		var $newElems = $( newElements ).css({ opacity: 0 });
		$newElems.imagesLoaded(function(){	
			$newElems.animate({ opacity: 1 });
			$container.masonry( 'appended', $newElems, true );
		});
	});

});
</script>
</body>

</html>

Download source code Here

 
 

How to make youtube video responsive ?

<style>
.videoResponsive {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}
 
.videoResponsive iframe,
.videoResponsive object,
.videoResponsive embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
</style>
<div class="videoResponsive">
	<iframe width="560" height="315" src="https://www.youtube.com/embed/8A6dW264sXM?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
</div>

 

How to make table responsive

<style>
.tblResponsive
{
	width:100%;
}
.tblResponsive tr td
{
	border-bottom:solid 1px #e6e6e6;
	padding:5px;
}
.tblResponsive tr.tblHead td
{
	font-weight:bold;
}
@media only screen and (max-width: 480px) {

.tblResponsive tr.tblHead
{
	display:none;
}

.tblResponsive tr,
.tblResponsive td
{
	display:block;
}

.tblResponsive tr
{
	border-bottom:solid 5px #e6e6e6;
}
.tblResponsive tr td
{
	padding-left:50%;
}

.tblResponsive tr td:before
{
	content: attr(abbr);
    left: 5px;
    position: absolute;
    text-align: left;
    width: 45%;
	font-weight:bold;
}

}
</style>
<table class="tblResponsive">
	<tr class="tblHead">
		<td>Heading 1</td>
		<td>Heading 2</td>
		<td>Heading 3</td>
		<td>Heading 4</td>
		<td>Heading 5</td>
		<td>Heading 6</td>
		<td>Heading 7</td>
		<td>Heading 8</td>
		<td>Heading 9</td>
		<td>Heading 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>
	<tr>
		<td abbr="Heading 1">Data 1</td>
		<td abbr="Heading 2">Data 2</td>
		<td abbr="Heading 3">Data 3</td>
		<td abbr="Heading 4">Data 4</td>
		<td abbr="Heading 5">Data 5</td>
		<td abbr="Heading 6">Data 6</td>
		<td abbr="Heading 7">Data 7</td>
		<td abbr="Heading 8">Data 8</td>
		<td abbr="Heading 9">Data 9</td>
		<td abbr="Heading 10">Data 10</td>
	</tr>					
</table>
 

Difference between Placeholder and Value

While using input tag in HTML form we use two common attributes that are value and placeholder.

If as seen from user perspective these two seems to be same , because while entering the data these two attributes are actually the content which are already written in form before user.

e.g. :-

<input type="text" value="Alok"/>

<input type="text" placeholder="Alok"/>

The value attribute define the default value of input. If user does not give any input then this default value would be considered as input while the placeholder is just the dummy text which shows or depicts that what type of text is to be input in the field.If for any input tag value attribute is not defied and only placeholder is defied then if user is not giving any input will be considered as blank.