Jump to content

Search the Community

Showing results for tags 'attribute'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Adrian Bahmani

  • Quotations
    • Quotes
  • Programming
    • HTML Tutorial
    • JavaScript Tutorial
  • Rarmer
    • Articles
    • Mudras
    • Meditation
    • Yoga Poses
    • Yoga Breathing

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 2 results

  1. HTML Id Attribute ( HTML ID آشنای با صفت ) The id attribute is used to specify the unique ID for an element of the HTML document. It allocates the unique identifier which is used by the CSS and the JavaScript for performing certain tasks. Note: In the Cascading Style sheet (CSS), we can easily select an element with the specific id by using the # symbol followed by id. Note: JavaScript can access an element with the given ID by using the getElementById() method. Syntax <tag id="value"> Example 1: The following example describes how to use the id attribute in CSS document: <!DOCTYPE html> <html> <head> <title> Example of Id attribute in CSS </title> <style> #Cars { padding: 40px; background-color: lightblue; color: black; text-align: center; } #Bikes { padding: 50px; background-color: lightGreen; text-align: center; } </style> </head> <body> <p> Use CSS to style an element with the id: </p> <h1 id="Cars"> Cars </h1> <h1 id="Bikes"> Bikes </h1> </body> </html> Output: Example 2: The following example describes how to use the ID attribute in JavaScript. <!DOCTYPE html> <html> <head> <title> Date Attribute </title> <script> function viewdate() { var x = document.getElementById("dob").value; document.getElementById("demo").innerHTML = x; </script> </head> <body> Employee Name: <input type="text" placeholder="Your Good name"/> <br> <br> Date of Joining: <input type="date" id="dob"> <br> <button onclick="viewdate()"> Submit </button> <br> <h2 id="demo"> </h2> </body> </html> Output:
  2. HTML Attribute HTML attributes are special words which provide additional information about the elements or attributes are the modifier of the HTML element. Each element or tag can have attributes, which defines the behaviour of that element. Attributes should always be applied with start tag. The Attribute should always be applied with its name and value pair. The Attributes name and values are case sensitive, and it is recommended by W3C that it should be written in Lowercase only. You can add multiple attributes in one HTML element, but need to give space between two attributes. Syntax <element attribute_name="value">content</element> Example <!DOCTYPE html> <html> <head> </head> <body> <h1> This is Style attribute</h1> <p style="height: 50px; color: blue">It will add style property in element</p> <p style="color: red">It will change the color of content</p> </body> </html>
×
×
  • Create New...