I am unable to convert this code into dynamic. how to adjust width of div so that it adjust dynamically. When we use any device like mobile desktop tablet or any other device it should display same. when we resize it it does not change appearance. I adjusted width using percentage but it not work properly.
<div class="bubble1" style="background: rgb(255, 255, 255); border-radius:
10px; box-shadow: rgba(0, 0, 0, 0.3) 0px 0px 8px; clear: both; font-family:
Arial, Helvetica, sans-serif; font-size: 12px; margin: 10px auto; position:
relative; width: 650px; z-index: 9;">
<div class="rectangle" style="background: rgb(127, 157, 185); box-shadow:
rgba(0, 0, 0, 0.55) 0px 0px 4px; float: left; height: 50px; left: -15px;
position: relative; top: 30px; width: 680px; z-index: 10;">
<h2 style="color: white; font-size: 30px; font-style: italic; font-
weight:
normal; line-height: 1.2em; margin: 0px 0px 20px; padding: 6px 0px 0px;
text-align: center; text-shadow: rgba(0, 0, 0, 0.2) 1px 1px 2px;">
abash</h2>
</div>
<div class="triangle-l" style="border-color: transparent rgb(125, 144, 163)
transparent transparent; border-style: solid; border-width: 15px; height:
0px; left: -30px; position: relative; top: 65px; width: 0px; z-index: -1;">
</div>
<div class="triangle-r" style="border-color: transparent transparent
transparent rgb(125, 144, 163); border-style: solid; border-width: 15px;
height: 0px; left: 650px; position: relative; top: 35px; width: 0px; z-
index: -1;">
</div>
<div class="info" style="color: #999999; padding: 60px 25px 35px;">
<div id="inf303">
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Meaning</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
शर्मिंदा करना, Cause to feel embarrassed</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Key</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
बेशर्म</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Link</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
बेशर्म लोगों की खुद की तो इज्ज़त होती नहीं और दूसरों को शर्मिंदा करते रहते हैं.</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Synonyms</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
Embarrass, shame, disconcert, confound, awe</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Usage</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
she was not <span style="background-attachment: initial; background-
clip: initial; background-image: initial; background-origin: initial;
background-position: initial; background-repeat: initial; background-size:
initial; border: none; color: #333333; padding: 0px
2px;">abashed</span> at being caught</div>
</div>
</div>
</div>
Not a good practice to inline-style everything in your HTML.
You can use media-query that below 680px screen size, your div will take whole width of the container.
.bubble1 {
width: 650px;
}
.rectangle {
width: 680px;
}
.triangle-r {
left: 650px;
}
#media only screen and (max-width: 680px) {
.bubble1 {
width: 100%;
}
.rectangle {
width: 110%;
}
.triangle-r {
left: 100%;
}
}
<div class="bubble1" style="background: rgb(255, 255, 255); border-radius:
10px; box-shadow: rgba(0, 0, 0, 0.3) 0px 0px 8px; clear: both; font-family:
Arial, Helvetica, sans-serif; font-size: 12px; margin: 10px auto; position:
relative; z-index: 9;">
<div class="rectangle" style="background: rgb(127, 157, 185); box-shadow:
rgba(0, 0, 0, 0.55) 0px 0px 4px; float: left; height: 50px; left: -15px;
position: relative; top: 30px; z-index: 10;">
<h2 style="color: white; font-size: 30px; font-style: italic; font-
weight:
normal; line-height: 1.2em; margin: 0px 0px 20px; padding: 6px 0px 0px;
text-align: center; text-shadow: rgba(0, 0, 0, 0.2) 1px 1px 2px;">
abash</h2>
</div>
<div class="triangle-l" style="border-color: transparent rgb(125, 144, 163)
transparent transparent; border-style: solid; border-width: 15px; height:
0px; left: -30px; position: relative; top: 65px; width: 0px; z-index: -1;">
</div>
<div class="triangle-r" style="border-color: transparent transparent
transparent rgb(125, 144, 163); border-style: solid; border-width: 15px;
height: 0px; position: relative; top: 35px; width: 0px; z-
index: -1;">
</div>
<div class="info" style="color: #999999; padding: 60px 25px 35px;">
<div id="inf303">
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Meaning</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
शर्मिंदा करना, Cause to feel embarrassed</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Key</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
बेशर्म</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Link</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
बेशर्म लोगों की खुद की तो इज्ज़त होती नहीं और दूसरों को शर्मिंदा करते रहते हैं.</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Synonyms</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
Embarrass, shame, disconcert, confound, awe</div>
<div class="val" style="background: url("/newindex/grad.png") no-
repeat rgb(236, 242, 245); font-size: 16px; font-weight: 1000; height: 20px;
padding: 5px; width: 480px;">
<strong>Usage</strong></div>
<div class="val1" style="font-size: 16px; margin-bottom: 10px;">
she was not <span style="background-attachment: initial; background-
clip: initial; background-image: initial; background-origin: initial;
background-position: initial; background-repeat: initial; background-size:
initial; border: none; color: #333333; padding: 0px
2px;">abashed</span> at being caught</div>
</div>
</div>
</div>
You could trying setting the width of the div using the vw unit. vw sets the the width of an element in relation to the viewport width. Theres also vh for viewport height.
Example:
width = 50vw;
This sets the width of the element to 50% of the viewport width. Therefore, the width of your div would be dynamically set to fit various screen sizes.
<div style="border: 1px solid red; padding: 15px; min-width:100px; display: inline-block height: fit-content">
test text
</div>
Try This.
To make the page responsive with css you can use the #media only screen property. Media queries allow you to change the style of an element as you prefer for different devices and screen sizes :
#media only screen and (max-width: 400px) //Only apply the following styles for screen sizes than do not exceed a maximum width of 400px.
{
div
{
//Add styles here for all div elements, to be applied only on screen sizes less than 400px wide.
}
body
{
//Add styles here for the document body, to be applied only on screen sizes less than 400px wide.
}
}
Div and body style will be applied only on screens with a width less than 400px.
You can set as many media queries as you want to make your website responsive across all devices.
Related
I'm making a counter that is contained within a box. I'm trying to make this counter responsive to different screen sizes, but the media query I'm trying to use will not work for some reason.
I have tried changing the the device width to below 768px but the query has no effect on the counter and I'm not sure why. I have included the HTML/PHP code for the counter as well as the CSS. Can anybody figure out why it's not working
I have made sure this tag is included in the head of the document.
<meta name="viewport" content="width=device-width, initial-scale=1">
Code:
.wrapper {
width: 100%;
float: center
}
.counter-container {
top: 14vh;
right: 4%;
float: right;
width: auto;
height: auto;
background-color: rgb(0, 0, 0, 0.7);
border-radius: 4%;
font-family: Trebuchet MS;
color: white;
}
.counter {
margin-bottom: 5px;
}
.count-title {
font-size: 10px;
font-weight: bolder;
margin-top: 0;
margin-bottom: 0;
text-align: center;
line-height: 70px;
}
.count-text {
font-size: 16px;
font-weight: bold;
margin: 5px 20px 10px 20px;
text-align: center;
color: white;
}
.count-dial {
font-size: 14px;
font-weight: normal;
margin: 8px 5px;
text-align: center;
}
.counter-closer {
float: right;
margin: 2px 6px;
padding: 0;
font-size: 18px;
background-color: rgb(0, 0, 0, 0.5);
}
.counter-closer:hover {
-webkit-filter: invert(1);
filter: invert(1);
}
.counter-digit {
background-image: linear-gradient(180deg, rgb(153, 255, 102), rgb(0, 255, 0));
border-radius: 5%;
color: rgb(0, 128, 0);
padding: 5px;
font-size: 30px;
}
.counter-row {
display: flex;
justify-content: center;
width: 100%;
margin-top: 2px;
}
.bottle-icon {
width: 38px;
height: 50px;
margin: 0 10px 10px 0;
}
.rotate-bottle {
transform: rotate(25deg);
-webkit-animation: shake .5s ease-in-out .1s infinite alternate;
}
#-webkit-keyframes shake {
from {
-webkit-transform: rotate(35deg);
}
to {
-webkit-transform: rotate(15deg);
-webkit-transform: rotate(25deg);
}
<div class="counter col_fourth counter-container" id="bottleCounter">
<i class="fas fa-times counter-closer" onclick="closeCounter()"></i>
<div class="counter-row">
<!--NB 19.11.21 green bottle image next to counter-->
<img class="bottle-icon rotate-bottle" src="https://img.resultclothing.net/icons/Green_Bottle.png" alt="water bottle">
<h2 class="count-title count-number">
<?php
$bottleCount = str_split(intval($var));
echo '
<span class="timer counter-digit" data-to="'.$bottleCount[0].'" data-speed="5000"></span>
<span class="timer counter-digit" data-to="'.$bottleCount[1].'" data-speed="5000"></span>
<span class="timer counter-digit" data-to="'.$bottleCount[2].'" data-speed="5000"></span>
<span class="timer counter-digit" data-to="'.$bottleCount[3].'" data-speed="5000"></span>
<span class="timer counter-digit" data-to="'.$bottleCount[4].'" data-speed="5000"></span>
<span class="timer counter-digit" data-to="'.$bottleCount[5].'" data-speed="5000"></span>
<span class="timer counter-digit" data-to="'.$bottleCount[6].'" data-speed="5000"></span>';
?>
</h2>
</div>
<p class="count-text">
<?php echo constant('LANG_FOOTER_BOTTLES_REC'); ?>
</p>
</div>
the missing closing bracket
Add the closing bracket to you keyframe
#-webkit-keyframes shake {
from{
-webkit-transform: rotate(35deg);
}
to {
-webkit-transform:rotate(15deg);
-webkit-transform:rotate(25deg);
}
}
Image of the boxes:
Boxes stacked
My question is. How do I get this third box to go under the first box and not in the center, but I also need everything to be in the center of the page.
You can either resort to flex or do change the display property , so ideally you should have code like below
.test li {
border: 1px solid black;
/*display: inline-block; change this to block*/
display: block;
float: left;
font-size: 20px;
list-style-type: none;
width: 150px;
height: 150px;
line-height: 30px;
padding-left: 1px;
padding-right: 1px;
margin: 15px 25px;
text-align: center;
border-radius: 5%;
background-color: rgb(255, 255, 255, 0.9);
}
Try this:
.test {
box-sizing: border-box;
position: absolute;
left: 50%;
margin-left: -200px;
}
ul {
position: relative;
}
.test li {
display: inline-block;
border: 1px solid black;
font-size: 20px;
list-style-type: none;
width: 150px;
height: 150px;
line-height: 30px;
padding-left: 1px;
padding-right: 1px;
margin: 15px;
text-align: center;
border-radius: 5%;
background-color: rgb(255, 255, 255, 0.9);
}
li:nth-child(3) {
display: block;
left: 100px;
bottom: 200px;
}
<div class="test">
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
</ul>
</div>
<?php
session_start();
include_once 'villagedb.php';
if(isset($_SESSION['user'])!="")
{
header("Location: home.html");
}
if(isset($_POST['btn-login']))
{
$email = mysql_real_escape_string($_POST['email']);
$upass = mysql_real_escape_string($_POST['pass']);
$res=mysql_query("SELECT * FROM users WHERE email='$email'");
$row=mysql_fetch_array($res);
if($row['password']==md5($upass))
{
$_SESSION['user'] = $row['user_id'];
header("Location: home.html");
}
else
{
?>
<script>alert('wrong details');</script>
<?php
}
}
?>
<!DOCTYPE html>
<html>
<head>
<style>
body
{
background-image: url("c413.jpg");
background-size:100% 100%;
font: 13px/20px "Lucida Grande", Tahoma, Verdana, sans-serif;
color: #404040;
background-repeat:no-repeat;
cursor:pointer;
}
.three{
margin: -5px;
width:100%;
text-align:center;
top:18.25%;
position:absolute;
color:#555;
font: 50px "Lucida Grande", Tahoma, Verdana, sans-serif;
text-shadow: 0 -2px black;
text-align: center;
}
.four{
margin: 50px auto;
width: 550px;
bottom:0;
position:absolute;
right: 70%;
display; none;
}
.one{
overflow: hidden;
position: fixed;
left:80%;
right:0;
height:75px;
bottom:0;
max-width: 400000px;
margin: 0 auto;
padding:0;
color: #555;
font: 13px "Lucida Grande", Tahoma, Verdana, sans-serif;
}
.one a{
text-decoration:none;
color: #555;
font: 13px "Lucida Grande", Tahoma, Verdana, sans-serif;
}
.container {
width: 100%;
top:28%;
position:relative;
text-align: center;
}
.login {
position: relative;
margin: 0 auto;
padding: 20px 20px 20px;
width: 310px;
}
.login p.submit {
text-align: right;
}
.login-help {
margin: 20px 0;
font-size: 11px;
color: white;
text-align: center;
}
.login-help a {
text-decoration: none;
color: #555;
}
.login-help a:hover {
text-decoration: underline;
}
:-moz-placeholder {
color: #c9c9c9 !important;
font-size: 13px;
}
::-webkit-input-placeholder {
color: #ccc;
font-size: 13px;
}
.login:before {
content: '';
position: absolute;
top: -8px;
right: -8px;
bottom: -8px;
left: -8px;
z-index: -1;
background: rgba(0, 0, 0, 0.08);
border-radius: 4px;
}
.login h1 {
margin: -20px -20px 21px;
line-height: 40px;
font-size: 15px;
font-weight: bold;
color: #555;
text-align: center;
text-shadow: 0 1px white;
background: #f3f3f3;
border-bottom: 1px solid #cfcfcf;
border-radius: 3px 3px 0 0;
background-image: -webkit-linear-gradient(top, whiteffd, #eef2f5);
background-image: -moz-linear-gradient(top, whiteffd, #eef2f5);
background-image: -o-linear-gradient(top, whiteffd, #eef2f5);
background-image: linear-gradient(to bottom, whiteffd, #eef2f5);
-webkit-box-shadow: 0 1px whitesmoke;
box-shadow: 0 1px whitesmoke;
}
.login p {
margin: 20px 0 0;
}
.login p:first-child {
margin-top: 0;
}
.login input[type=text], .login input[type=password] {
width: 278px;
}
.login p.remember_me {
float: left;
line-height: 31px;
}
.login p.remember_me label {
font-size: 12px;
color: #777;
cursor: pointer;
}
.login p.remember_me input {
position: relative;
bottom: 1px;
margin-right: 4px;
vertical-align: middle;
}
input {
font-family: 'Lucida Grande', Tahoma, Verdana, sans-serif;
font-size: 14px;
}
input[type=text], input[type=password] {
margin: 5px;
padding: 0 10px;
width: 200px;
height: 34px;
color: #404040;
border-radius: 2px;
-moz-outline-radius: 3px;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}
input[type=text]:focus, input[type=password]:focus {
border-color: #7dc9e2;
outline-color: #dceefc;
outline-offset: 0;
}
input[type=submit] {
padding: 0 18px;
height: 29px;
font-size: 12px;
font-weight: bold;
color: #527881;
text-shadow: 0 1px #e3f1f1;
background: #cde5ef;
border: 1px solid;
border-color: #b4ccce #b3c0c8 #9eb9c2;
border-radius: 16px;
outline: 0;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
background-image: -webkit-linear-gradient(top, #edf5f8, #cde5ef);
background-image: -moz-linear-gradient(top, #edf5f8, #cde5ef);
background-image: -o-linear-gradient(top, #edf5f8, #cde5ef);
background-image: linear-gradient(to bottom, #edf5f8, #cde5ef);
-webkit-box-shadow: inset 0 1px white, 0 1px 2px rgba(0, 0, 0, 0.15);
box-shadow: inset 0 1px white, 0 1px 2px rgba(0, 0, 0, 0.15);
}
input[type=submit]:active {
background: #cde5ef;
border-color: #9eb9c2 #b3c0c8 #b4ccce;
-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2);
}
input[type=checkbox],
input[type=radio] {
border: 1px solid #c0c0c0;
margin: 0 0.1em 0 0;
padding: 0;
font-size: 16px;
line-height: 1em;
width: 1.25em;
height: 1.25em;
background: #fff;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ededed), to(#fbfbfb));
-webkit-appearance: none;
-webkit-border-radius: 0.25em;
vertical-align: text-top;
display: inline-block;
}
input[type=radio] {
-webkit-border-radius: 2em; /* Make radios round */
}
</style>
</head>
<body>
<div class="four"> <img src="untitled.png" width="100px" height="85px"></div>
<div class="three">
Village
</div>
<div class="container">
<div class="login">
<form method = "post" action="">
<input type="text" name ="email" placeholder="Username or Email"></input><br>
<input type="password" name ="pass" placeholder="Password"></input><br>
<p class="remember_me">
<label>
<label>
<input type="checkbox" name="remember_me" id="remember_me">
Keep me logged in
</label>
</label>
</p>
<p class="submit"><input type="submit" name="submit" value=" Login" name="btn-login"></p>
</form>
</div>
<div class="login-help">
<p> Forgot your password?</p>
</div>
</div>
<div class="one">
Sign Up<font size="1"> | </font>Terms & Conditions <font size="1"> | </font> More info
</div>
</body>
</html>
The background image in the css is stretch and cover a 25% of the page on load then after php run and reload it works fine.
What could be the problem?
change the css as follows
body
{
background-image: url("c413.jpg");
background-size: cover;
font: 13px/20px "Lucida Grande", Tahoma, Verdana, sans-serif;
color: #404040;
background-repeat:no-repeat;
cursor:pointer;
}
there is no issue related to php. you can remove the php tag
I'm having a problem with my CSS style sheet. I try inputting the values to the DIV CLASSES, but there is no effect. The style sheet worked fine on my other HTML website, but I'm using a common header and footer via PHP on this website and it seems like it's interfering with the CSS for some reason. I don't know if my coding has any fallacies in it, but from what I can see everything looks fine:
CSS STYLE SHEET
body {
background-color: #000;
font-family: Arial, Verdana;
color: #fff;
}
a:link {
color: #ff0;
text-decoration: none;
}
a:visited {
color: #ff0;
text-decoration: none;
}
a:hover {
color: #fff;
text-decoration: none;
}
a:active {
color: #000f;
text-decoration: none;
}
p {
text-align: justify;
font-size: 14px;
}
.container {
border: 1px solid #fff;
width: 820px;
height: 1350px;
padding: 10px;
}
.header {
background-image: url("/Images/CSS/logo.jpg");
background-position: center;
background-size: cover;
height: 20%;
width: 100%;
}
.logo {
background: -webkit-linear-gradient(bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
background: -o-linear-gradient(top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
background: -moz-linear-gradient(top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
background: linear-gradient(top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
border: 0px solid #fff;
height: 90%;
width: 100%;
}
.logo h1 {
margin: 15px;
color: #ffa500;
float: right;
position: relative;
bottom: -160;
}
.logo p {
font-size: 12px;
margin: 15px;
color: #ffa500;
float: left;
position: relative;
bottom: -175;
}
.userbar {
width: 100%;
height: 10%;
background-color: #000;
border: 1px solid #fff;
padding: 5px;
.body {
border: 0px solid #fff;
width: 100%;
height: 70%;
}
.left {
border: 1px solid #fff;
float: left;
width: 250px;
height: 100%;
}
.right {
border: 0px solid #fff;
float: right;
width: 550px;
height: 100%;
}
.nav {
width: 100%;
border: 1px solid #fff;
margin-top: 15px;
}
.nav ul {
margin: 0px;
padding: 0px;
list-style-position: none;
list-style: none;
}
.nav li {
width: 85%;
margin: 15px;
color: #fff;
border-bottom: 1px dotted #fff;
}
.side {
margin-top: 25px;
color: #fff;
width: 100%;
border: 1px solid #fff;
}
.content {
width: 100%;
}
.content p {
padding: 10px;
color: #fff;
text-align: justify;
border-style: solid;
border-width: 0px;
}
.footer {
height: 10%;
width: 100%;
border: 1px solid #fff;
}
.footer p {
padding: 5px;
color: #fff;
text-align: center;
}
.pic {
padding: 10px;
margin: 10px;
}
.pic p {
width: 430px;
text-align: center;
font-size: 9px;
}
.pic1 {
float: left;
padding: 10px;
margin: 10px;
border: 1px solid #fff;
}
.pic1 p {
width: 170px;
text-align: center;
font-size: 9px;
}
.pic2 {
float: right;
margin: 10px;
padding: 10px;
border: 1px solid #fff;
}
.pic2 p {
width: 170px;
text-align: center;
font-size: 9px;
}
Index Page
Note that the Index page itself is not html. It's a PHP file and I'm using separate PHP files for the header and footer. This is just the page source to let you see the layout of my website.
<html>
<head>
<title></title>
<link rel ="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<div class="header">
<div class="logo">
</div>
<div class="userbar">
</div>
</div>
<div class="body">
<div class="left">
<div class="nav">
<ul>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
<li>Item5</li>
<li>Item6</li>
<li>Item7</li>
</ul>
</div>
<div class="side">
<h3 align="center">News</h3>
</div>
</div>
<div class="right">
<div class="content"> </div><!----content----!>
</div><!----right----!>
<div class="footer">
</div>
</div><!----container----!>
</body>
</html>
I have an existing div and I want to add some new data (5 spans) to this existing div. The method I was using makes the following GUI
I want it to display the search results in existing div (in black translucent region). My HTML Code is
<title>Search your Friends</title>
<body>
<div class="title">
GTBIT's Almuni Diary
</div>
<div class="main">
<form id="myForm" method="POST">
<input placeholder="Enter some text to search"type="text" class="name" name="query">
<br>
<span class="searchby">Search Criteria</span>
<select name="criteria">
<option value="name" selected="selected">Search by Name</option>
<option value="enrno">Search by Enrollment No.</option>
<option value="email">Search by Email ID</option>
<option value="phno">Search by Phone No.</option>
</select>
<br>
<input type="button" class="search" value="Search">
</form>
<div class="sr">
Search Results
</div>
<div class="dynamicData">
<div class="header">
<span class="heading">Name</span>
<span class="heading">Email ID</span>
<span class="heading">Enrollment No.</span>
<span class="heading">Nickname</span>
<span class="heading">Batch</span>
</div>
<div class='dataDiv'>
</div>
</div>
</div>
CSS :
body
{
font-family: "source sans pro";
font-size: 20px;
background-image: url("../images/searchbg.jpg");
background-size: 100% 100%;
background-attachment: fixed;
background-repeat: no-repeat;
}
.title
{
display: none;
color: #03C9A9;
background-color: rgba(0,0,0,0.8);
padding: 5px;
font-weight: 500;
font-size: 54px;
height: 90px;
text-align: center;
}
.main
{
display: none;
width: 90%;
margin: 0 auto;
margin-top: 20px;
background-color: rgba(0,0,0,0.5);
padding: 20px;
}
.searchby, input, select
{
color: white;
font-family: inherit;
font-size: 28px;
display: inline-block;
}
.name
{
color: black;
width: 80%;
}
.searchby
{
margin-top: 40px;
}
select
{
border: 0px solid white;
margin-left: 30px;
margin-right: 30px;
color: black;
font-size: 22px;
}
.search
{
background-color: rgba(0,0,0,0.8);
color: #03C9A9;
margin: 0 auto;
margin-top: 30px;
padding: 5px;
display: block;
border: 0px solid white;
cursor: pointer;
font-size: 32px;
}
.name
{
margin-left: 10px;
border: 0px solid white;
}
.sr
{
margin-top: 75px;
font-family: inherit;
font-size: 32px;
width: 100%;
text-align: center;
background-color: rgba(0,0,0,0.8);
color: #03C9A9;
margin-bottom: 50px;
}
.dynamicData
{
width: 98%;
margin-left: 10px;
padding: 2px;
background-color: rgba(0,0,0,0.3);
}
.header
{
padding: 5px;
width: 90%;
text-align: center;
padding: 5px 0px 5px 0px;
margin: 0 auto;
}
.heading
{
background-color: #03C9A9;
color: white;
font-family: inherit;
font-size: 24px;
height: 30px;
width: 202px;
display: inline-block;
margin-bottom: 10px;
}
.dataDiv
{
padding: 2px;
width: 90%;
text-align: center;
margin: 0 auto;
}
.data
{
font-family: inherit;
font-size: 24px;
height: 30px;
width: 202px;
display: inline-block;
margin-bottom: 5px;
color: black;
background-color: rgba(255,255,255,0.75);
}
PHP Script responsible for adding (after getting data form database)
while($stmt->fetch())
{
echo "<br>
<span class='data ndata'>$nm</span>
<span class='data emaildata'>$em</span>
<span class='data enrnodata'>$eno</span>
<span class='data nicknamedata'>$nn</span>
<span class='data batchdata'>$bt</span>";
}