Tuesday 15 March 2016

Embedding Flash Movie In The Html Page

Though using flash in Html is bit outdated now. But sometimes it neccesary for clients requirment to match. Playing Video and audios or animations in webpage is much easier in Html5, but sometimes concept of webpage requires higher functionality. In this situation we needs to take help of Flash. 

Here we are writing <object> tag to embed flash object into our code.

<object width="550" height="400">


<param name="movie" value="somefilename.swf">


<embed src="/support/somefilename.swf" width="550" height="400">


</embed>


</object>

Thus <object> tag is valid XHtml tag, but <embed> tag is not. Embed was used for Netscape based browsers.

<object type="application/x-shockwave-flash" data="music/sound.swf" width="550" height="400">

<param name="movie" value="music/sound.swf" />

<param name="quality" value="high"/>

</object>


The width and height tags specify size of the movie, which you will need to adjust. This is the minimum code you need to embed a Flash movie in a browser. If user's browser dose not support Flash Player, it will tell to install it.

Tuesday 22 September 2015

Amazing CSS attribute Selector with substring matching selection

CSS attribute Selector


If you have learned html and css, you must be aware of how to target element with id or class in css.

<p id="demo_id" class="demo_class"> </p>

above element has id and class which you can use in css to target p element as "#demo_id" and ".demo_class". But apart from these selectors you can select element with other attributes using attribute selector.


<p id="demo_id" class="demo_class" rel="name" title="name of Jon"> </p>

In above P tag we can see attributes other than class and id, like "rel", "title". So it is possible to us to user these attributes for selecting perticuler P tag.



p[rel] {
    background-color: yellow;
}

this css will target p tag which has rel attribute and change its background color to yellow.

It is also possible to use attribute with value. Let's see another example. If we have two P tags


<p rel="name">Rajesh</p>
<p rel="email">rajesh@something.com</p>

And in css if we write


  p[rel="name"]{
    background-color: yellow;
}


Then this css will be apply for the p tag with rel has value "name".


Attribute selector has lot more option to do. Let's take a look at these.

Above example is attribute with exactly match value.


[attribute~="value"] Selector.

The [attribute~="value"] selector is used to select elements with an attribute value containing a specified word.

The following example selects all elements with a title attribute that contains a space-separated list of words, one of which is "image":

<img src="image1.jpg" title="small image " width="150" height="113">
<img src="image2.jpg " title=" image " width="224" height="162">


[attribute|="value"] Selector

The [attribute|="value"] selector is used to select elements with the specified attribute starting with the specified value.

The following example selects all elements with a class attribute value that begins with "top":

Note: The value has to be a whole word, either alone, like class="top", or followed by a hyphen( - ), like class="top-text"!


<h1 class="top-header">Welcome</h1>
<p class="top-text">Hello world!</p>
  

[attribute^="value"] Selector

The [attribute^="value"] selector is used to select elements whose attribute value begins with a specified value.

The following example selects all elements with a class attribute value that begins with "top":

Note: The value does not have to be a whole word!

<h1 class="top-header">Welcome</h1>
<p class="top-text">Hello world!</p>
<p class="topcontent">Are you learning CSS?</p>



[attribute$="value"] Selector

The [attribute$="value"] selector is used to select elements whose attribute value ends with a specified value.

The following example selects all elements with a class attribute value that ends with "test":

Note: The value does not have to be a whole word!


<div class="first_test">The first div element.</div>
<div class="my-test">The third div element.</div>
<p class="mytest">This is some text in a paragraph.</p>


[attribute*="value"] Selector

The [attribute*="value"] selector is used to select elements whose attribute value contains a specified value.

The following example selects all elements with a class attribute value that contains "te":

Note: The value does not have to be a whole word!


<div class="first_test">The first div element.</div>
<div class="second">The second div element.</div>
<div class="my-test">The third div element.</div>
<p class="mytest">This is some text in a paragraph.</p>


Thursday 4 December 2014

Editable div in Html 5 with contenteditable attribute

We use input or textarea are use to edit or input text. But now a days when we need design as well as editable things we need more than that.

The contenteditable attribute specifies whether the content of an element is editable or not.

Any elements with the 
contenteditable attribute set will have a grey outline as you hover over. Feel free to edit and change their contents. I'm using local storage to maintain your changes.

           contenteditable=""  or  contenteditable="true"
Indicates that the element is editable.

           contenteditable"false"
Indicates that the element is not editable.

            contenteditable"inherit"
Indicates that the element is editable if its immediate parent element is editable. This is the default value.


 This is div with 'contenteditable' true.
<div id="example" contenteditable="true">

Editable text



Simple popup box in Jquery

While building dynamic web pages popups are useful for showing information of inputs other than content that is shown on page. Mostly html alert popup is used to some info like 'alerts or information for website'. But when development needs popup that do multiple things with multiple formats, alert box is not enough.

Jquery popup


          In this case we need a custom pop up that satisfy our need. We can see that there are many jquery plugin that provide custom popup. But they come with external js & css files with complex format to implement. That is why I want to built my own custom popup.

          We will build this with ‘div’ in html, which will be hidden on page load.  After clicking on link this popup will be shown by jquery. The code is given below

<!DOCTYPE html>
<html lang="en">
<head>
    <title>test</title>

<style>
.popup-back {
    float: left;
    background-color: rgba(51, 51, 51, 0.71);
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display:none;
    z-index:10000;
}

.popup-con {
    margin: auto;
    width: 600px;
    position: relative;
}

.popup-body {
    background-color: #fff;
    padding: 10px;
    position: absolute;
    width: 100%;
    top: 100px;
}

a.close-popup {
font-family: arial;
text-decoration: none;
background-color: #333;
color: #fff;
border-radius: 50%;
height: 21px;
position: absolute;
width: 20px;
text-align: center;
right: 5px;
top: 5px;

}
    </style>
   
</head>
<body>

<h1>Pop ups</h1>
<a href="#" class="link-class popup-link" rel="my_popup1">popup 1</a>
<a href="#" class="link-class popup-link" rel="my_popup2">popup 2</a>

<div class="popup-back popup-spclass" id="my_popup1">

        <div class="popup-con">
                <div class="popup-body">

                <a href="#" class="close-popup"></a>
                        <h1>this is my 1st popup</h1>

                        <p>Simple way for popup</p>
               
                </div>
        </div>


</div>


<div class="popup-back popup-spclass" id="my_popup2">

        <div class="popup-con">
                <div class="popup-body">

                <a href="#" class="close-popup"></a>
                        <h1>this is my 2nd popup</h1>

                        <p>Simple way for popup</p>
               
                </div>
        </div>


</div>


 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script type="text/javascript">
        $(".popup-link").click(function () {
            var popupId = "#" + $(this).attr("rel");

            $(popupId).fadeIn();


        });
        $(".close-popup").click(function () {

            $(".popup-spclass").fadeOut();


        });
       
    </script>
</body>
</html>




Wednesday 8 October 2014

10 Responsive Html5 - Css3 website templates free

SquadFree – Bootstrap Free HTML Template



Sublime – Stunning HTML5/CSS3 Website Template


Timber – Free One Page Bootstrap Template


E-Shopper – Best Free Ecommerce HTML Template


AdminLTE Dasboard and Control Panel Template


Magnetic – Free Photography Website Template


Mabur Portfolio Theme


Modern Bootstrap HTML Template


Sport Business Html Template


Crafty – Corporate HTML Template