Header menu

_________________________________________________________________________________
Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Friday, 25 July 2014

Table data overflowing even after giving fixed width due some long string .


 

Table data overflowing even after giving fixed width due some long string .

After giving fixed width to table and column ,we suppose that we will get same type of table every time. But sometime due to some long string which is greater than width of column , table overflows of given width.

To tackle that problem add these two small lines to your style:



Firstly , give fixed layout out to table and secondly add word-wrap: break-word; property to column . And you are all done :)

Tuesday, 27 May 2014

Extract parameters from url using javascript or jquery in html file.


 

Parsing url in jquery or javascript to extract parameter from url in html file


If you are using a html file and you have to receive some parameters from url , then
below is the method you are looking for.

Only this you have to do ... is to call getUrlVars with field name to extract as done in this statement  :

var first_name = getUrlVars()["first_name"];  


Tuesday, 20 May 2014

In how ways you can add css to a html page ?


 

Methods to add css to html page :

We can add css to a page using 3 methods :

a) External css
b) Internal css 
c) Inline css 

External css : In this we make an css file and then call that file in our page using link .
      

Internal css : In this we write our css in head of the the html page using style tag.
               

Inline css : In this we add style to the element . 

The best method of adding css is external and the most powerful is inline because override    previous css included.

Wednesday, 5 March 2014

How to create Fixed left sidebar in html ?


To create a fixed left sidebar in html we need to make its position fixed in css and float left so that sidebar remain left aligned.

 float:left;
 position:fixed; 

These two lines will do the magic for you. To understand more run the below example:


<html>
           <head>

                      <style>
                                 .left-sidebar{
                                                        float:left;
                                                        position:fixed;
                                                        width:200px;
                                                        background-color:#47D7ED;
                                                     }
                                 .left-sidebar p {
                                                         width:700px;
                                                         text-align:justify;
                                                      }
                                 .container1{
                                                        position:relative;
                                                        width:84%;
                                                        background-color:#FFFFFF;
                                                        border:1px solid;
                                                        min-height:1500px;
                                                        height:auto;
                                                        margin-left: 205px;
                                                      }
                         </style>
            </head>
<body>
           <div class='left-sidebar' id='left-sidebar'>
                     <ul>
                            <li id='li-banner'>Banners</li>
                            <li id='li-banner1'>Banners</li>
                           <li id='li-banner2'>Banners</li
                     </ul>
             </div>
             <div id='container' class='container1'>
                      <h1>My Left Side bar is fixed.</h1>
                      <h1>Its not gonna move :)</h1>
             </div>
</body>
</html>


Wednesday, 26 February 2014

How to create a link on button tag in html ?


Button with link

Sometimes we need to create link on button in html . To do so we just need to add button tag on text of <a> tag.

In below line of code we have applied <button> tag on text of <a> tag.

<a href="http://www.codesplanet.blogspot.com" target="_parent"><button>Click me !</button></a>

Now we have a button with link on it 

Tuesday, 29 October 2013

Concatenate html tags to string in php

To add html tags to string in php ... You have to concatenate html tags with string using htmlentities()
as shown below
$newstring="<u>".htmlentities("test")."</u>";
Here i have added <u> tag to my string test which is passed to htmlentities() function for concatenation.

For more details see the example
Example:

<?php
$mystring="Hello ... This is my test string . I am testing it for htmlentities()";
echo "This is string before adding html tags"."</br>";
echo "</br>";
echo $mystring;
echo "</br>";
echo "</br>";
$newstring="<u>".htmlentities("test")."</u>";
$finalstring=str_replace("test",$newstring,$mystring);
echo "This is string after add html tags"."</br>";
echo "</br>";
echo $finalstring;
?>


htmlentities

Friday, 13 September 2013

Append some (text/img) after some html element using jquery

How to append some (text/img) after some html element using jquery 

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script type="text/javascript" >
        $(document).ready(function(){
var i=0;
        $("#sub").on("click",function(){
     $( "#1" ).append("Test "+i+" ... ");
         i++;
         });      
         });
</script>
</head>
<body>
<div id="1">This is my test...</div>
<button type="button"  id="sub">Append</button>
</form>
</body>
</html>

Tuesday, 20 August 2013

How to write your first php script ?

What you need ?

1. A server
2. A php file to be put in your www. or htdocs directory..

Phpfile

<?php

echo "My first PHP script!";
 

?>