abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.
Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

12/14/2020

How to create Overlay box or modal to complete page.

 <html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

.overlay {

  display: none;

  position: fixed;

  z-index: 1;

  padding-top: 100px;

  left: 0;

  top: 0;

  width: 100%;

  height: 100%;

  overflow: auto;

  background-color: rgb(0,0,0);

  background-color: rgba(0,0,0,0.4);

}

.overlay-content {

  background-color: #fefefe;

  margin: auto;

  padding: 20px;

  border: 1px solid #888;

  width: 80%;

}

.closebtn {

  color: #aaaaaa;

  float: right;

  font-size: 28px;

  font-weight: bold;

}


.closebtn:hover,

.closebtn:focus {

  color: #000;

  text-decoration: none;

  cursor: pointer;

}

</style>

</head>

<body>


<h2>overlay Example</h2>


<!-- Trigger/Open The overlay -->

<button id="myBtn" onclick="openoverlay()">Open overlay</button>


<!-- The overlay -->

<div id="myoverlay" class="overlay">


  <!-- overlay content -->

  <div class="overlay-content">

    <span class="closebtn" onclick="closebtn()">&times;</span>

    <p>Some text in the overlay..</p>

  </div>


</div>


<script>

var overlay = document.getElementById("myoverlay");

var btn = document.getElementById("myBtn");

var span = document.getElementsByClassName("closebtn")[0];

function openoverlay()

{

  overlay.style.display = "block";

}

function closebtn()

{

  overlay.style.display = "none";

}

window.onclick = function(event)  //outside overlay box click also hide box.

{

  if (event.target == overlay) {

    overlay.style.display = "none";

  }

}

</script>


</body>

</html>


in above example we have set two class one cover complete webpage, other is overlay box, one close button two hide open box.

simple display:none or block properties set from script and style. position must fixed to cover all page & background set rgba color.


How to create Responsive Image(All Devices good view) with Transparent text

 <html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

* {

  box-sizing: border-box;

}


 


.container {

  position: relative;

  max-width: 800px;

  margin: 0 auto;

}


.container img {vertical-align: middle;}


.container .content {

  position: absolute;

  bottom: 0;

  background: rgb(0, 0, 0); 

  background: rgba(0, 0, 0, 0.5); 

  color: #ffffff;

  width: 100%;

  padding: 20px;

}

</style>

</head>

<body>


<h5>Responsive Image with Transparent Text</h5>


<div class="container">

  <img src="trial.jpg" alt="background" style="width:100%;">

  <div class="content">

    <h1>Heading</h1>

    <p>Sample Text here Sample Text hereSample Text hereSample Text hereSample Text hereSample Text here.</p>

  </div>

</div>


</body>

</html>


in above example if you observe class 'content' which text overlay and transparent view using background: rgba(0, 0, 0, 0.5); 


RGBA - set opacity of rgb(red, green, blue) color , in above 0.5 means transparent to background up to half.

Share your valuable comment.

How to create Responsive header for Mobile webpages

 Responsive means which is works on all devices, it is mobile friendly. and it's also good SEO & user interface.


<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

* {box-sizing: border-box;}


body { 

  margin: 0;

  font-family: Arial, Helvetica, sans-serif;

}


.header {

  overflow: hidden;

  background-color: #f1f1f1;

  padding: 20px 10px;

}


.header a {

  float: left;

  color: black;

  text-align: center;

  padding: 12px;

  text-decoration: none;

  font-size: 18px; 

  line-height: 25px;

  border-radius: 4px;

}

 


.header a:hover {

  background-color: #ddd;

  color: black;

}


.header a.active {

  background-color: dodgerblue;

  color: white;

}


.header-right {

  float: right;

}


@media screen and (max-width: 500px) {

  .header a {

    float: none;

    display: block;

    text-align: left;

  }

  

  .header-right {

    float: none;

  }

}

</style>

</head>

<body>


<div class="header">

  <a href="#default" class="logo"><img src="logo.png"/></a>

  <div class="header-right">

    <a class="active" href="#home">Home</a>

    <a href="#contact">Contact</a>

    <a href="#about">About</a>

  </div>

</div>


<div style="padding-left:20px">

  <h5>Responsive Header</h5>

  <p>Some sample content..</p>

</div>


</body>

</html>


check above code on mobile which shows different view of header , which is easy to user access.


How to create vertical tabs using CSS and JAVASCRIPT

 <html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

* {box-sizing: border-box}

body {font-family: "Lato", sans-serif;}


/* Style the mytab */

.mytab {

  float: left;

  border: 1px solid #ccc;

  background-color: #f1f1f1;

  width: 30%;

  height: 300px;

}


/* Style the buttons inside the mytab */

.mytab button {

  display: block;

  background-color: inherit;

  color: black;

  padding: 22px 16px;

  width: 100%;

  border: none;

  outline: none;

  text-align: left;

  cursor: pointer;

  transition: 0.3s;

  font-size: 17px;

}


/* Change background color of buttons on hover */

.mytab button:hover {

  background-color: #ddd;

}


/* Create an active/current "mytab button" class */

.mytab button.active {

  background-color: #ccc;

}


/* Style the mytab content */

.mytabcontent {

  float: left;

  padding: 0px 12px;

  border: 1px solid #ccc;

  width: 70%;

  border-left: none;

  height: 300px;

}

</style>

</head>

<body>


<h2>Vertical mytabs</h2>

<p>Click on the buttons inside the mytabbed menu:</p>


<div class="mytab">

  <button class="mytablinks" onclick="openCity(event, 'India')" id="defaultOpen">India</button>

  <button class="mytablinks" onclick="openCity(event, 'America')">America</button>

  <button class="mytablinks" onclick="openCity(event, 'Africa')">Africa</button>

</div>


<div id="India" class="mytabcontent">

  <h3>India</h3>

  <p>India is the capital city of England.</p>

</div>


<div id="America" class="mytabcontent">

  <h3>America</h3>

  <p>America is the capital of France.</p> 

</div>


<div id="Africa" class="mytabcontent">

  <h3>Africa</h3>

  <p>Africa is the capital of Japan.</p>

</div>


<script>

function openCity(evt, cityName) {

  var i, mytabcontent, mytablinks;

  mytabcontent = document.getElementsByClassName("mytabcontent");

  for (i = 0; i < mytabcontent.length; i++) {

    mytabcontent[i].style.display = "none";

  }

  mytablinks = document.getElementsByClassName("mytablinks");

  for (i = 0; i < mytablinks.length; i++) {

    mytablinks[i].className = mytablinks[i].className.replace(" active", "");

  }

  document.getElementById(cityName).style.display = "block";

  evt.currentTarget.className += " active";

}


// Get the element with id="defaultOpen" and click on it

document.getElementById("defaultOpen").click();

</script>

   

</body>

</html> 


12/13/2020

how to create Icons like social media, emoji, alert and other for website, app

 icon can be created,

i) using font family

ii) using js file

iii) using html entity

iv) using css



- using awesome js - in this js all types icon available like emoji, alert, animation, social icon, media & so on.


<head>

<title>Font Awesome Icons</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

<script src="https://kit.fontawesome.com/a076d05399.js"></script>

<!--just go to above site and create own js file which is free-->

</head>

<body>


<p>Some Font Awesome icons:</p>

<i class="fas fa-band-aid"></i>

<i class="fas fa-cat"></i>

<i class="fas fa-dragon"></i>

<i class="far fa-clock"></i>


- using font family 


<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

</head>

<body>


<i class="fa fa-cloud"></i>

<i class="fa fa-heart"></i>

<i class="fa fa-car"></i>

<i class="fa fa-file"></i>

<i class="fa fa-bars"></i>


</body>

</html>


https://fonts.googleapis.com/icon?family=Material+Icons  this is google icon


- using bootstrap - just use class name glyphicon, glyphicon-trash


<p>Trash icon on a button:

        <button type="button" class="btn btn-default btn-sm">

          <span class="glyphicon glyphicon-trash"></span> Trash 

        </button>

      </p>


all above fonts works on all devices, browser, responsive, easy to load , lightweight.


how to create loading spinner or loading symbol

creating spinner or loader when loads webpage or any div or block , saving data state.

let us see small example,

 <!DOCTYPE html>

<html>

<head>

  <title>Bootstrap Example</title>

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

</head>

<body>


<div class="container">

  <h2>Colored Spinners</h2>

  <p>Use any color utilites to add a color to the spinner:</p>

                                        

  <div class="spinner-border text-muted"></div>

  <div class="spinner-border text-primary"></div>

  <div class="spinner-border text-success"></div>

  <div class="spinner-border text-info"></div>

  <div class="spinner-border text-warning"></div>

   

</div>

</body>

</html>

in above example first call bootstrap.min.js and bootstrap.min.css, then use spinner-border class as above declare

Application  - this is useful when loading page, loading div, or button when submit

Notes - above files bootstrap.min.js and bootstrap.min.css are free to use.

12/12/2020

How to create fixed header menu using html

fixed header menu using html

 in this blog shows how to make fixed header or menu bar, suppose user move scroll and developer wants menubar should fixed to easy navigation from pages.

<html>

<style>

.home {

    width: 100%; height:100%; overflow-y: scroll;

    margin-top: 100px;

}



div.header {

position: fixed;

top: 0;

left: 0;

right: 0;

}

</style>

<body>


<div class="header" style="width:100%; text-align: center; background: #000000; padding-top: 4%; padding-bottom: 4%;">

        <p style="vertical-align: middle; color: white">Head Bar</p>

</div>

    <div class="home">

            <img src="photo1.jpg" style="width:100%; height:30%; max-height:30%;"/>

            <div>

                <p>Title 1</p>

                <p>Content 1</p>

                <p>Author: Alex</p>

            </div>

            <img src="photo2.jpg" style="width:100%; height:30%; max-height:30%;"/>

            <div>

                <p>Title 2</p>

                <p>Content 2.</p>

                <p>Author: Alex</p>

            </div>

            <img src="photo3.jpg" style="width:100%; height:30%; max-height:30%;"/>

            <div>

                <p>Title 3</p>

                <p>Content 3.</p>

                <p>Author: Alex</p>

            </div>

    </div>

</body>

</html>


in above example header class setting fixed position , if user moving scroll position it still fixed header

please comment your query or valuable message.


How to create full screen video using html and css

create full screen video using html and css

<html>

<body>

<style>

/* video: 100% width and height- cover the entire window */

#myVideo {

  position: fixed;

  bottom: 0;

  right: 0;

  min-width: 100%;

  min-height: 100%;

}


/* Add content at the bottom of the video/page */

.content {

  position: fixed;

  bottom: 0;

  background: rgba(0, 0, 0, 0.5);

  color: #f1f1f1;

  width: 100%;

  padding: 20px;

}


/* Style the button used to pause/play the video */

#abcbutton {

  width: 200px;

  font-size: 18px;

  padding: 10px;

  border: none;

  background: #000;

  color: #fff;

  cursor: pointer;

}


#abcbutton:hover {

  background: #ddd;

  color: black;

}

</style>

<!-- The video -->

<video autoplay muted loop id="myVideo">

  <source src="hello.mp4" type="video/mp4">

</video>


<!-- Optional: some overlay text to describe the video -->

<div class="content">

  <h1>Sample Text</h1>

  <p>Learn with Mayur Infosys Solutions</p>

  <button id="abcbutton" onclick="myFunction()">Pause</button>

</div>

</body>

</html>


above code in html and css which works on all devices, while creating webpage required full screen in these case use above sample code. 

1)we set video to position fixed

2)all corner zero position , no padding

3) content also fixed and set to bottom position.


please comment if any query OR suggest new topic for blog.

5/22/2018

CSS background & effect


HTML , css  Background & effect on div
Background of div or table or span or para or any html element will be set using css .
Following different style are used while setting background
1)      Background : setting background of element:  such as image or color or center or different position , repeat or not repeat , set size to 100% 100% è background size
Eg:
<html>
<body>
<style>
div
{
Background:  url(‘abc.png’);
Height:150px;
Padding:0;
Margin:0;
}
</style>
<div>
Hi hello how are you
</div>
</body>
</html>
2)  background-image:  specific to only set image in above property of background you can set both image or color
syntax: background-image:url(‘abc.png’);

3)      background-attachment :  setting background attachment whether fixed or flexible
4)      background-color :  setting background color there are different color available in css such hexa , rgb, rgba .
5)      background-position: left, right , top, right different position or center
6)      Background-repeat: whether repeat or not repeat .  repeat to x or y
7)      Background-blend-mode : to set blend mode of background such as color, color-burn, color-darken , color-diffrence, normal , multiply saturation this are different blending mode.

Thanks for viewing blog send comment in case any query.

HTML & CSS Image create & effect


HTML , css  Image  & effect
In this section we learn img tag , border affect on image, image shadow, thumbnail image, image in different shape.
<img src =”images/abc.png”  alt=”no image found” />
In image tag shows png image i.e.  portable network graphics, similarly define jpg(joint picture graphics) & gif(graphics interchange format)
Alt attribute is used to in case image not support or not found then alt text is show not necessary to show this attribute.

Border radius is use for set curve fashion to all four corner
Eg:
 border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;

& suppose plain border for example set 5px blue border
Eg: <img src=”images/abc.png” style=”border: 5px solid blue”/>
Image shadow :  set shadow for imageà 0 0 20px rgba(0, 0, 0, .2);
In above apply rgba color to image shadow so that is show some front face from its original background.

Image thumbnail:  showing images look like thumbnail
Eg: <img src=”abc.png”  style=”padding:5px ; border: 1px solid #eaeaea”/>

In above case apply padding such way so its look thumbnail image.

Suppose show image in circle shape then use border-radius :50% ;
Adjust four or more images in one line then
<table width=”25%”>
<tr>
<td width=”25%”>
<img src=”abc.png” width=”100%”/>
</td>
<td width=”25%”>
<img src=”abc2.png” width=”100%”/>
</td>
<td width=”25%”>
<img src=”abc3.png” width=”100%”/>
</td>
<td width=”25%”>
<img src=”abc4.png” width=”100%”/>
</td>
</tr>
</table>

In this way using table to 100% in which equal 25% each column & 100% image in each column , so that  all image in one line for any screen resolution.

Note: while making website it is necessity to check whether all images work in all browser(chrome, opera, firefox, safari, ie8)  & all screen it may be mobile or tab or laptop.
Thanks for viewing blog send comment in case any query.

An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...