HTML5 URL Input Type - HTML CSS HTML

HTML CSS examples for HTML:Form Input

Description

HTML5 URL Input Type

Demo Code

ResultView the demo in separate window

Enter URL in the form like http://www.java2s.com

<!DOCTYPE html>
<html lang="en">
 <head> 
  <title>HTML5 URL Input Type</title> 
  <style type="text/css">
    input[type="url"]:valid{
        outline: 2px solid green;
    }<!--   w w w  .j  a  va2s . com-->
    input[type="url"]:invalid{
        outline: 2px solid red;
    }
</style> 
 </head> 
 <body> 
  <form> 
   <label> Website URL: <input type="url" name="mywebsite" required> </label> 
  </form> 
  
 </body>
</html>

Related Tutorials