Friday, August 21, 2020

css example

 Example:- 1

part1.html

---------------

<!DOCTYPE html>

<html lang="en" dir="ltr">

  <head>

    <meta charset="utf-8">

    <title>CSS BASIC</title>

    <link rel="stylesheet" href="part1_master.css">

  </head>

  <body>

    <h1>This is the heading</h1>

    <p>Let's see a list:</p>

    <ol>

      <li>Item One</li>

      <li>Item Two</li>

      <li>Item Three</li>

    </ol>


<h4>This is heading 4.</h4>

  </body>

</html>

========================================================================
part1_master.css
--------------------

/*selected tag{
  property:vaue;
}
*/
h1{
  color: red;
}

li{
  color: rgb(247, 83, 7);
}

p{
  color: #07bbf7;
}

h4{
  color: rgba(247, 83, 7,1);
}
=========================================================================
=========================================================================



Example:-
part2.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>CSS BASIC</title>
    <link rel="stylesheet" href="Part2_master.css">
  </head>
  <body>

    <p>This is paragraph,outside any div</p>
    <div>
      <p>I'm inside the div</p>
      <p>I'm also inside the div</p>
      <p>Inside div <span>INSIDE SPAN!</span></p>

    </div>

  </body>
</html>
========================================================================
part2_master.css

/*selected tag{
  property:vaue;
}
*/
body{
  background: url("https://www.holidify.com/images/cmsuploads/compressed/goa-quick-guide_20180528135357.jpg");
  background-repeat: no-repeat;
}

div{
  background-color: blue;
  border-color:orange;
  border-width: 4px;
  border-style: double;
}

p{
  color: yellow;
}

span{
  background:red;
  color:black;
}
=========================================================================
Example:-3
part3.html


<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
      <link rel="stylesheet" href="Part3_master.css">
  </head>
  <body>
    <h3>I'm a h3 heading</h3>

    <div class="firstDiv">
      <p>I'm inside the firstDiv class</p>

    </div>

    <div class="secondDiv">
      <p>I'm inside secondDiv Class</p>

    </div>

    <h3>Here is a list</h3>
    <ul>
      <li>confirm? <input type="checkbox" name="" value=""></li>
      <li>Facebook? <input type="text" name="" value=""></li>
      <li><a href="www.pieriandata.com">Pierian</a></li>
      <li><a href="www.npr.org">NPR</a></li>
    </ul>



  </body>
</html>
======================================================================
.firstDiv{
  color: blue;
}
.secondDiv{
  color: red;
}

#singledout{
  color:green;
  text-decoration: line-through;
}

h3 + ul{
  border: 4px dotted purple;
}

li a{
  color:red;
}

li a[href="www.npr.org"]{
  color: blue
  border: 5px solid orange;
}


forms example in Html

 Assessment.html


<!DOCTYPE html>

<html lang="en" dir="ltr">

  <head>

    <meta charset="utf-8">

    <title>Course Sign Up</title>

  </head>

  <body>

    <h1>Course Singn Up Page</h1>

    <p>Please Note: All text files required</p>

    <form action="thanku.html" method="get">

      <label for="fm">First Name</label>

      <input id="fm"type="text" name="" placeholder="First Name" required>


      <label for="ln">First Name</label>

      <input id="ln"type="text" name="" placeholder="Last Name" required>


     <p></p>



      <label for="mail">Email:</label>

      <input id="mail" type="email" name="" value="" placeholder="user@gmail.com" required>


      <label for="pass">Password:</label>

      <input type="password" name="" value="" required>


      <p>Are you over 18?</p>

      <label for="y">Yes:</label>

      <input id="y"type="radio" name="over" value="yes">

      <label for="n">No:</label>

      <input id="n"type="radio" name="over" value="no">


      <p>Do you have Card and paypal?</p>

      <select name="payment">

        <option value="cc"> Credit Card</option>

        <option value="pp">paypal</option>


      </select>


      <p></p>

      <input type="submit" name="" value="singn Up!">


    </form>


  </body>

</html>

=========================================================================
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <h1>THANK YOU !</h1>
  </body>
</html>
================================================================

Wednesday, August 19, 2020

How to work with Form in HTML

 Example 1:- form.html


<!DOCTYPE html>

<html lang="en" dir="ltr">

  <head>

    <meta charset="utf-8">

    <title></title>

  </head>

  <body>

    <form >

      <h1>Log In</h1>

      <h2>Please Input your Email and Password</h2>

      <input type="emai" name="useremail" value="Email Here">

      <input type="password" name="password" value="">

      <input type="submit" name="" value="Click Me">

    </form>


  </body>

</html>

=========================================================================
Example :- form2.html 

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <form >
      <h1>Choose Color</h1>
      <h1>Click on Button</h1>
      <input type="color" name="" value="">
    </form>
  </body>
</html>
=========================================================================

Example :- form3.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <form action="https://www.facebook.com" method="get">
      <p>Enter text and take me FB</p>
    <input type="text" name="userinput" value="">
    <input type="submit" name="submit" value="Submit">


    </form>
  </body>
</html>
=========================================================================
Example:- form4.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <form>
    <label>
      Enter Text:
   <input type="text" name="" value="block one">
    </label>
    <label >
    Enter Text:
    <input type="text" name="" value="block two">

    </label>

    </form>
  </body>
</html>
=========================================================================
Example:-5 

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
   <form >

    <!-- <label for="userinput">Enter Input:</label>-->
     <!--<input id="userinput" name="text" placeholder="Enter Email Here">-->
     <input type="text" name="" placeholder="not required">
     <input type="text" name="" placeholder="Required" required>
     <input type="submit" name="" value="sumbit">

   </form>

  </body>
</html>

How to work with Table in HTML

Example :-1 table.htlm 


<!DOCTYPE html>

<html lang="en" dir="ltr">

  <head>

    <meta charset="utf-8">

    <title>TABLES</title>

  </head>

  <body>


    <table border="1">

      <thead>

        <th>Number</th>

        <th>Color</th>

        <th>Country</th>


      </thead>

      <tr>

        <td>250</td>

        <td>Red</td>

        <td>USA</td>

      </tr>

      <tr>

        <td>100</td>

        <td>Blue</td>

        <td>France</td>

      </tr>

    </table>


  </body>

</html>

=========================================================================

Example 2:- table1.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <table border="2">
      <thead>
        <th>Country Name</th>
        <th>Country Flag</th>
        <th>GDP (Millions of USD)</th>
      </thead>
      <tr>
        <td>USA</td>
        <td><img src="https://cdn.britannica.com/s:500x350/81/4481-004-660915ED/flag-Stars-and-Stripes-July-4-1912.jpg" alt=""></td>
        <td>18,561,930</td>
      </tr>
      <tr>
        <td>INDIA</td>
          <td><img src="https://media.gettyimages.com/videos/india-flag-loopable-video-id590544878?s=640x640" alt=""></td>
            <td>2,250,990</td>
      </tr>
      <tr>
        <td>United Kigdom</td>
        <td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/a/ae/Flag_of_the_United_Kingdom.svg/1200px-Flag_of_the_United_Kingdom.svg.png" alt=""></td>
        <td>2,649,800</td>
      </tr>
    </table>
  </body>
</html>

Sunday, August 9, 2020

WAP to remove white space in String using built in and without inbuilt in method

 package com.javapractice;


public class RemoveWhiteSpace1 {

public static String removeWhiteString(String str){

String whilteSpace=str.replaceAll("\\s","");

System.out.println("Remove White Space of String::" +whilteSpace);

return whilteSpace;

}

public static String removewhiteSpacewithinbuilt(String str){

char[] ch=str.toCharArray();

for(char c:ch){

if(!(c==' ')){

System.out.print(c);

}

}

return str;

}

   public static void main(String[] args) {

removeWhiteString("  Bangalore    is    Beautiful  city    ");

removewhiteSpacewithinbuilt("  Bangalore    is    Beautiful  city    ");

}


}


Sunday, August 2, 2020

How to Reverse String in Core Java

package com.javapractice;

public class ReverseString {
public static String reverseString(String str){
char[] ch=str.toCharArray();
for(int i=ch.length-1;i>=0;i--){
System.out.println(ch[i]);
//String str1=""+ch[i];
}
String str1=new String();
System.out.println(ch);
return str;
}
public static String reverseStringStringButtfer(String str){
StringBuffer bf=new StringBuffer(str);
bf.reverse();
System.out.println(bf);
return str;
}
public static void main(String[] args){
reverseString("javaiseasy");
reverseStringStringButtfer("selenium");
}

}

Q) How To Find Duplicate Characters In A String In Java?

Step1:- Creating a HashMap containing char as key and it's occurrences as value. Step2:- Converting given string to char array. Step3:- ...