Search On Google

Saturday, December 29, 2018

HTML responsive

What is Responsive Web Design?
Responsive means pages will look good on all devices (desktops, tablets, and phones).

We know our page have 2 types of data images and text. So both should be responsive to make whole page responsive.

1.Responsive images:- For responsive image you should use width 100%.
<img src="img_girl.jpg" style="width:100%;">

2.Responsive texts:- VW stands for Viewport Width . Viewport is  browser window size. 100vw means 100% of view port width.

Media Query:-

To resize both text and images, you should use media queries for responsive web pages.
Media query is common for make responsive text and images both.

@media screen and (max-width: 800px) { //800 px is breakpoint
  #divA{
    width: 100%;
  }
}

//In above example media query CSS will apply for range 1px to  800px.


Responsive web design framework:-

1.Bootstrap:- In market many CSS frameworks are being use for Responsive Design.
One of them is bootstrap. For bootstrap you have to import 3 files of bootstrap js, css, jquery
CDN link is given in below example.

Excample:-


<!DOCTYPE html>
<html lang="en-us">
<head>
<title>bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

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

<body>
<div class="container-fluid">
  <div class="row">
    <div class="col-md-2"></div>
    <div class="col-md-8"></div>
    <div class="col-md-2"></div>
  </div>
</div>
</body>

</html>

Edit HTML Responsive Example in Editor


No comments:

Post a Comment

About Me

My photo
Mumbai, Maharashtra, India