I'm noob and I'm following different tutorial to achieve my goal and the goal is to make animated social icons in the footer and the problem is that the socials icons from FontAwesome are not working.
If i put them in < ul > they are not working but outside i can see them .-
How can i solve this to see them when I put them in < ul > ?
This is the code :
HTML :
<!DOCTYPE html>
<html>
<head>
<title>Contact us</title>
<link rel="stylesheet" type="text/css" href="stilecontact.css">
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/17fe744bb9.js" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
</head>
<body>
<section>
<div class="circle"></div>
<header>
<img src ="logo.jpg">
</header>
</div>
<div class="container">
<div class="contact-box">
<div class="left"></div>
<div class="right">
<h2>Contact Us</h2>
<input type="text" class="field" placeholder="Your Name">
<input type="text" class="field" placeholder="Your Email">
<input type="text" class="field" placeholder="Phone">
<textarea placeholder="Message" class="field"></textarea>
<button class="btn">Send</button>
</div>
</div>
</div>
</body>
<footer>
<ul>
<li><i class="fa-brands fa-twitter"></i></li>
<li><i class="fa-brands fa-facebook"></i></li>
<li><i class="fa-brands fa-instagram"></i></li>
</ul>
</footer>
</html>
This is CSS:
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Quicksand', sans-serif;
}
body{
height: 100vh;
width: 100%;
}
.container{
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 20px 100px;
}
.container:after{
content: '';
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: url("team.jpg") no-repeat center;
background-size: cover;
filter: blur(50px);
z-index: -1;
}
.contact-box{
max-width: 850px;
display: grid;
grid-template-columns: repeat(2, 1fr);
justify-content: center;
align-items: center;
text-align: center;
background-color: #fff;
box-shadow: 0px 0px 19px 5px rgba(0,0,0,0.19);
}
.left{
background: url("team.jpg") no-repeat center;
background-size: cover;
height: 100%;
}
.right{
padding: 25px 40px;
}
h2{
position: relative;
padding: 0 0 10px;
margin-bottom: 10px;
}
h2:after{
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
height: 4px;
width: 50px;
border-radius: 2px;
background-color: #2ecc71;
}
.field{
width: 100%;
border: 2px solid rgba(0, 0, 0, 0);
outline: none;
background-color: rgba(230, 230, 230, 0.6);
padding: 0.5rem 1rem;
font-size: 1.1rem;
margin-bottom: 22px;
transition: .3s;
}
.field:hover{
background-color: rgba(0, 0, 0, 0.1);
}
textarea{
min-height: 150px;
}
.btn{
width: 100%;
padding: 0.5rem 1rem;
background-color: #2ecc71;
color: #fff;
font-size: 1.1rem;
border: none;
outline: none;
cursor: pointer;
transition: .3s;
}
.btn:hover{
background-color: #27ae60;
}
.field:focus{
border: 2px solid rgba(30,85,250,0.47);
background-color: #fff;
}
#media screen and (max-width: 880px){
.contact-box{
grid-template-columns: 1fr;
}
.left{
height: 200px;
}
}
footer {
margin: o;
padding: o;
box-sizing: border-box;
}
body footer {
display:flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #000;
}
ul
{
position: relative;
display: flex;
color: #fff;
}
ul li
{
position: relative;
list-style: none;
margin: 0 20px;
cursor: pointer;
}
ul li a
{
text-decoration: none;
}
ul li a .fa
{
font-size: 6em;
color: #222;
}
ul li ::before
{
font-family: fontAwesome;
position: absolute;
top: 0;
left: 0;
font-size: 6em;
height: 0;
overflow: hidden;
transition: 0.5s ease-in-out;
}
ul li:nth-child(1)::before
{
content: '\f099';
color: #1da1f2;
border-bottom: 4px solid #1da1f2;
}
ul li:nth-child(2)::before
{
content: '\f09a';
color: #07476f;
border-bottom: 4px solid #1da1f2;
}
ul li:nth-child(3)::before
{
content: '\f16d';
color: #f24f1d;
border-bottom: 4px solid #f2391d;
}
Icons were there, but they were not visible. So for your reference, I have given red color.
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Quicksand', sans-serif;
}
body{
height: 100vh;
width: 100%;
}
.container{
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 20px 100px;
}
.container::after{
content: '';
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: url("team.jpg") no-repeat center;
background-size: cover;
filter: blur(50px);
z-index: -1;
}
.contact-box{
max-width: 850px;
display: grid;
grid-template-columns: repeat(2, 1fr);
justify-content: center;
align-items: center;
text-align: center;
background-color: #fff;
box-shadow: 0px 0px 19px 5px rgba(0, 0, 0, 0.19);
}
.left{
background: url("team.jpg") no-repeat center;
background-size: cover;
height: 100%;
}
.right{
padding: 25px 40px;
}
h2{
position: relative;
padding: 0 0 10px;
margin-bottom: 10px;
}
h2::after{
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
height: 4px;
width: 50px;
border-radius: 2px;
background-color: #2ecc71;
}
.field{
width: 100%;
border: 2px solid rgba(0, 0, 0, 0);
outline: none;
background-color: rgba(230, 230, 230, 0.6);
padding: 0.5rem 1rem;
font-size: 1.1rem;
margin-bottom: 22px;
transition: 0.3s;
}
.field:hover{
background-color: rgba(0, 0, 0, 0.1);
}
textarea{
min-height: 150px;
}
.btn{
width: 100%;
padding: 0.5rem 1rem;
background-color: #2ecc71;
color: #fff;
font-size: 1.1rem;
border: none;
outline: none;
cursor: pointer;
transition: 0.3s;
}
.btn:hover{
background-color: #27ae60;
}
.field:focus{
border: 2px solid rgba(30, 85, 250, 0.47);
background-color: #fff;
}
#media screen and (max-width: 880px){
.contact-box{
grid-template-columns: 1fr;
}
.left{
height: 200px;
}
}
footer {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body footer {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #000;
}
ul
{
position: relative;
display: flex;
color: #fff;
}
ul li
{
position: relative;
list-style: none;
margin: 0 20px;
cursor: pointer;
}
ul li a
{
text-decoration: none;
}
ul li a .fa
{
font-size: 6em;
color: #222;
}
ul li::before
{
font-family: sans-serif;
position: absolute;
top: 0;
left: 0;
font-size: 6em;
height: 0;
overflow: hidden;
transition: 0.5s ease-in-out;
}
ul li:nth-child(1)::before
{
content: '\f099';
color: #1da1f2;
border-bottom: 4px solid #1da1f2;
}
ul li:nth-child(2)::before
{
content: '\f09a';
color: #07476f;
border-bottom: 4px solid #1da1f2;
}
ul li:nth-child(3)::before
{
content: '\f16d';
color: #f24f1d;
border-bottom: 4px solid #f2391d;
}
<!DOCTYPE html>
<html>
<head>
<title>Contact us</title>
<link rel="stylesheet" type="text/css" href="stilecontact.css">
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/17fe744bb9.js" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<section>
<div class="circle"></div>
<header>
<img src="logo.jpg">
</header>
</div>
<div class="container">
<div class="contact-box">
<div class="left"></div>
<div class="right">
<h2>Contact Us</h2>
<input type="text" class="field" placeholder="Your Name">
<input type="text" class="field" placeholder="Your Email">
<input type="text" class="field" placeholder="Phone">
<textarea placeholder="Message" class="field"></textarea>
<button class="btn">Send</button>
</div>
</div>
</div>
</body>
<footer>
<!-- <ul>
<li><i class="fa-brands fa-twitter"></i></li>
<li><i class="fa-brands fa-facebook"></i></li>
<li><i class="fa-brands fa-instagram"></i></li>
</ul> -->
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-facebook"></i>
<i class="fa-brands fa-instagram"></i>
<div style="color:red">
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-facebook"></i>
<i class="fa-brands fa-instagram"></i>
</div>
</footer>
</html>
found the solution !
HTML
<!DOCTYPE html>
<html>
<head>
<title>Contact us</title>
<link rel="stylesheet" type="text/css" href="stilecontact.css">
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
</head>
<body>
<section>
<div class="circle"></div>
<header>
<img src="logo.jpg">
</header>
</div>
<div class="container">
<div class="contact-box">
<div class="left"></div>
<div class="right">
<h2>Contact Us</h2>
<input type="text" class="field" placeholder="Your Name">
<input type="text" class="field" placeholder="Your Email">
<input type="text" class="field" placeholder="Phone">
<textarea placeholder="Message" class="field"></textarea>
<button class="btn">Send</button>
</div>
</div>
</div>
</body>
<footer>
<ul>
<li><i class="fa fa-twitter" aria-hidden="true"> </i> </li>
<li><i class="fa fa-instagram" aria-hidden="true"> </i> </li>
<li><i class="fa fa-facebook" aria-hidden="true"> </i> </li>
</ul>
</div>
</footer>
</html>
CSS
*{
margin: 0;
padding: 0;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #000000;
}
ul{
position: relative;
display: flex;
}
ul li{
position: relative;
list-style: none;
margin: 0 20px;
cursor: pointer;
}
ul li a{
text-decoration: none;}
ul li a .fa{
font-size: 6em;
color: #222;
}
ul li a .fa:hover{
opacity: 0;
transition: opacity 0.2s ease-in;
}
ul li:before{
position: absolute;
font-family: FontAwesome;
top: -10px;
left: 0;
font-size: 6em;
width: 100%;
height: 0;
overflow: hidden;
transition: .3s ease-in-out;
}
ul li:nth-child(1)::before{
content: '\f099';
color: #1da1f2;
border-bottom: 4px solid #1da1f2;
}
ul li:nth-child(2)::before{
content: '\f232';
color: #25d366;
border-bottom: 4px solid #25d366;
}
ul li:nth-child(3)::before{
content: '\f16a';
color: #ff0000;
border-bottom: 4px solid #ff0000;
}
ul li:hover:before{
height: 110%;
}
body {
background-image: url("pirat.jpg");
}
h1{
font-size :100px;
}
h3{
font-size :50px;
}
<style type="text">
*{
box-sizing: border-box;
outline: none;
}
body{
margin: 0;
padding: 0;
}
.container{
width: 100%;
height: 100px;
margin: 0;
padding: 0;
}
img{
width: 100%;
height: 100vh;
}
.container nav{
position: absolute;
width: 100%;
top: 0;
height: 60px;
background-color: #383838;
color: white;
}
nav ul{
float: right;
list-style: none;
margin: 0;
padding: 0;
width: 600px;
}
nav li{
display: inline-block;
line-height: 56px;
margin:0 25px;
}
nav li a{
display: block;
color: white;
text-decoration: none;
font-size: 13px;
transition: .5s all;
}
a:hover{
color:#808080;
border-bottom: 5px solid white;
}
#myInput{
position: relative;
margin-top: 10px;
padding: 5px 10px 5px 20px;
width: 2300x;
height: 25px;
border-bottom: 2px solid#006699;
font-size: 15px;
color: #006699;
border-radius: 50px;
align-items: center;
float: right;
z-index: 0;
}
#btn{
display: none;
}
.check{
font-size: 30px;
color: white;
float: right;
line-height: 60px;
margin-right: 20px;
margin-left: 10px;
cursor: pointer;
transform: rotate(-90deg);
display: none;
}
#media(max-width: 800px){
nav ul{
position: fixed;
width: 40%;
height: 100vh;
top: 60px;
left: 100%;
text-align: center;
background-color: #2c3e50;
transition: all .5s;
}
nav ul li{
display: block;
}
nav ul li a{
font-size: 20px;
color: white;
}
.check{
display: block;
}
#btn:checked ~ ul{
left: 60%;
}
#media(max-width: 500px){
}
#myUL {
list-style-type: none;
padding: 0;
margin: 0;
}
#myUL li a {
border: 1px solid #ddd;
margin-top: -1px;
background-color: #f6f6f6;
padding: 12px;
text-decoration: none;
font-size: 18px; color: black;
display: block;
}
#myUL li a:hover:not(.header) {
background-color: #eee; /* Add a hover effect to all links, except for headers */
}
.text input:focus + .hide {
display: block !important;
}
.hide {
display: none;
}
.container { position: relative; }
<html>
<head><title>Home</title>
<font color="white">
<center>
<h1></h1>
</center>
<link rel="stylesheet" type="text/css" href="Principala.css">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
</head>
<body>
<font color="white">
<div class="relative">
<font color = "blue">
<h3></h3>
<div class="container">
<nav>
<input type="checkbox" name="" id="btn">
<label for="btn" class="check">!!!</label>
<div class="search"><input type="text" id="myInput" onkeyup="myFunction()" placeholder="search engine"></div>
<ul>
<li>HOME</li>
<li>SERVICE</li>
<li>CONTACT</li>
<li>FAQ</li>
<li>ABOUT US</li>
</ul>
</nav>
<div class=hide>
<ul id="myUL">
<li>Adele</li>
<li>Agnes</li>
<li>Billy</li>
<li>Bob</li>
<li>Calvin</li>
<li>Christina</li>
<li>Cindy</li></ul></div>
<script src="Principala.js"></script>
</script>
</body>
</html>
What is wrong? The suggestions don't want to show when I write in the search box
code
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: sticky;
}
li {
float: right;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
border-left: 1px solid #bbb;
}
li a:hover {
background-color: #111;
}
.btn {
background: #ebc22f;
border: 2px solid #eee;
border-radius: 15px;
box-shadow: 5px 5px 5px #eee;
text-shadow: none;
padding: 10px 10px;
}
input[type=text] {
padding: 12px 20px;
border-radius: 20px;
border-color: gray;
width: 35%;
}
body h1 {
text-align: center;
}
body {
top: 50%;
left: 50%;
display: block;
overflow: auto;
}
<header>
<ul>
<li>Advanced Search</li>
<li>Image Search</li>
<li>Google Search</li>
</ul>
</header>
<body>
<h1>Google Search</h1>
<form action="https://google.com/search">
<input type="text" name="q" alt="Enter Your Query">
<input class="btn" type="submit" value="Google Search">
</form>
</body>
Hi, It is just a simple question I have. I have no idea how to center the body. I have tried doing top: 50% and left 50% and that doesn't seem to work. I have also tried at adding padding on all sides but that makes the page go wonkers. Margin does the same as well. Thank for helping!
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: sticky;
}
li {
float: right;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
border-left: 1px solid #bbb;
}
li a:hover {
background-color: #111;
}
.btn {
background: #ebc22f;
border: 2px solid #eee;
border-radius: 15px;
box-shadow: 5px 5px 5px #eee;
text-shadow: none;
padding: 10px 10px;
}
input[type=text] {
padding: 12px 20px;
border-radius: 20px;
border-color: gray;
width: 35%;
}
body h1 {
text-align: center;
}
body {
top: 50%;
left: 50%;
display: block;
overflow: auto;
text-align: center;
}
<header>
<ul>
<li>Advanced Search</li>
<li>Image Search</li>
<li>Google Search</li>
</ul>
</header>
<body>
<h1>Google Search</h1>
<form action="https://google.com/search">
<input type="text" name="q" alt="Enter Your Query">
<input class="btn" type="submit" value="Google Search">
</form>
</body>
Just add text-align: center; to your body.
and of course your html isn't valid, And probably everything should be centered.
you did something wrong which makes change direction's or alignments.
Look at this (it helps you):
https://www.w3.org/Style/Examples/007/center.en.html
I am trying to make a note website. But I noticed that there is a differents between Firefox design tool and my own iphone
But when I test it on my mobile device (iphone 7+) I am getting a other result
I hope someone knows the answer to my problem.
Thanks in advance.
PS..
I used https://howchoo.com/g/mte2zgrhmjf/how-to-access-a-website-running-on-localhost-from-a-mobile-phone to acces the website on my phone
<style>
html{
width: 100vw;
}
/*thead a:link{
padding-left: 5px;
padding-top: 5px;
padding-bottom: 0px;
}*/
nav{
display: none;
}
thead a:link {
color: #262626;
padding: 13px 1px;
text-align: center;
text-decoration: none;
display: inline-block;
}
.note{
/*display: none;*/
}
.page-header{
left: 50%;
}
h1{
color:#262626;
}
body{
text-align: center;
font-family: Arial;
}
ul {
text-align: center;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #e6e6e6;
position: -webkit-sticky; /* Safari */
position: sticky;
top: 0;
}
nav a:link {
background-color: #e6e6e6;
color: #262626;
padding: 5px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
li {
float: left;
}
/*dropdown nav*/
.dropbtn {
background-color: #4CAF50;
color: white;
/*padding: 16px;*/
font-size: 16px;
border: none;
cursor: pointer;
}
.dropdown {
text-align: left;
position: relative;
display: block;
width: 100%;
cursor: pointer;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
/*min-width: 160px;*/
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
width: 100%;
}
#bars{
width: 22px;
font-size: 25px;
}
.dropdown-content a {
text-align: left;
color: black;
padding: 10px 10px 10px 10px;
text-decoration: none;
display: block;
width: 548px;
}
.dropdown-content a:hover {
background-color: #009fe3;
color: white;
}
.dropdown-content .active {
color: white;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #009fe3;
}
/*dropdown nav end*/
#text{
display: none;
}
.topnav-right a{
height: 25px;
}
.topnav-right {
float: right;
list-style-type: none;
}
li a {
display: block;
color: #262626;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}
li a:hover {
background-color: #009fe3;
color: white;
}
.active:hover{
background-color:#009fe3;
}
.active {
background-color: #262626;
color: white;
}
/*form styling*/
.input_form {
width: 90%;
margin: 30px auto;
border-radius: 5px;
padding: 10px;
background: white;
border: 1px solid #262626;
}
.input_form {
color: red;
margin: 0px;
}
.task_input {
border-radius: 5px;
width: 50%;
height: 15px;
padding: 10px;
border: 1px solid #262626;
}
.date_input {
border-radius: 5px;
width: 100px;
height: 15px;
padding: 10px;
border: 1px solid #262626;
}
.add_btn {
cursor: pointer;
height: 39px;
background: white;
color: #262626;
border: 1px solid #262626;
border-radius: 5px;
margin: 5px;
padding: 5px 20px;
}
.add_btn:hover{
background: #009fe3;
color: white;
}
table {
width: 100%;
margin: 30px auto;
border-collapse: collapse;
}
tr {
border-bottom: 1px solid #262626;
height: auto;
}
tr a{
height: auto;
}
th{
height: auto;
}
th, td {
text-align: left;
font-size: 19px;
color: #262626;
}
th, td{
border: none;
height: auto;
padding: 2px;
}
td{
border-left: 1px solid #262626;
border-left: none;
}
tbody a:link {
background-color: white;
color: #262626;
padding: 13px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
.select{
display: none;
}
/*complete button*/
.complete{
text-align: center;
width: 10px;
}
.complete a:visited{
color: #262626;
}
.complete a{
color: #262626;
text-decoration: none;
}
.complete a:hover {
background-color: #009fe3;
color: white;
}
/*Delete button*/
.delete{
text-align: center;
width: 10px;
}
.delete a:visited{
color: #262626;
}
.delete a{
color: #262626;
text-decoration: none;
}
.delete a:hover {
background-color: #009fe3;
color: white;
}
.restore{
text-align: center;
width: 10px;
}
.restore a:visited{
color: #262626;
}
.restore a{
color: #262626;
text-decoration: none;
}
.restore a:hover {
background-color: #009fe3;
color: white;
}
/*completeAll button*/
.completeAll a:visited{
color: #262626;
}
.completeAll a:hover {
background-color: #009fe3;
color: white;
}
/*restoreAll button*/
.restoreALL, .restoreALL a:visited{
color: #262626;
}
.restoreALL a:hover {
background-color: #009fe3;
color: white;
}
/*Edit button*/
.edit a:visited{
color: #262626;
}
.edit{
/*text-align: left;*/
display: none;
width: auto;
text-align: center;
}
.edit a:hover{
color:white;
background-color: #009fe3;
}
.timer-off{
color:red;
}
#form3{
display: none;
}
#completed{
display: none;
float: center;
}
#link, #link:visited{
color: red;
float: right;
}
#link1, #link1:visited{
color: #009fe3;
}
#title{
cursor: pointer;
}
/*sort function styling for arrows*/
#up {
display: inline-block;
border: solid #262626;
border-width: 0 3px 3px 0;
padding: 3px;
transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
}
#down {
display: inline-block;
border: solid #262626;
border-width: 0 3px 3px 0;
padding: 3px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
/*search button*/
#myInput {
width: 50%;
font-size: 16px;
margin: 12px;
color: #262626;
padding: 12px 20px 12px 20px;
border: 1px solid #262626;
margin-bottom: 12px;
}
#myInput:focus{
border: 1px solid #009fe3;
}
/*style login page/register page*/
label{
float: left;
color: black;
}
.form-control[type=text], .form-control[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
.form-control1[type=text], .form-control1[type=date]{
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
.button {
background-color: #009fe3;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
.button:hover {
opacity: 0.8;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
img#randomImage {
width: 40%;
border-radius: 50%;
}
/*form edit.php and login.php */
#form{
margin: auto;
border: 1px solid #ccc;
box-sizing: border-box;
display: table;
width: 50%;
margin: 5% auto 15% auto;
}
/*form index.php*/
#form4{
margin: auto;
border: 1px solid #ccc;
box-sizing: border-box;
display: table;
width: 50%;
}
/*form register.php*/
#form1{
margin: auto;
border: 1px solid #ccc;
box-sizing: border-box;
display: table;
width: 100%;
margin: 1% auto 15% auto;
}
.form-group {
padding: 16px;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
position: relative;
}
img#randomImage {
width: 40%;
border-radius: 50%;
}
/* Change styles for span and cancel button on extra small screens */
#media screen and (max-width: 300px) {
#form{
/*height: 50%;*/
}
}
.note1{
width: auto;
}
.input_form {
width: 80%;
margin: auto;
border-radius: 5px;
padding: 10px;
background: white;
border: 1px solid #262626;
}
#link2{
font-size: 20px;
font-style: normal;
float: right;
margin: 5px;
}
#link2:visited{
color: #009fe3;
}
#link2:hover{
color: red;
}
.note4{
}
.task p{
font-size: 16px;
}
.date{
float: right;
margin-top: 10px;
width: auto;
}
#media screen and (min-width: 768px) {
.edit{
display: block;
}
nav{
display: block;
}
.date{
float: right;
}
#text{
display: block;
}
.dropdown{
display: none;
}
.note{
height: auto;
display: table-cell;
}
.task_input{
width: 70%;
height: auto;
}
#myInput{
width: 50%;
}
.select{
display: block;
font-size: 19px;
width: auto;
font-family: Arial;
font-weight: bold;
color: #262626;
}
#media screen and (min-width: 992px) {
.input_form p {
color: red;
margin: 0px;
}
.note{
width: auto;
}
.note1{
width: 70%;
max-height: 300px;
}
.task_input {
width: 80%;
height: 15px;
padding: 10px;
border: 1px solid #262626;
}
#myInput{
width: 20%;
}
table {
width: 80%;
}
</style>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<meta charset="UTF-8">
<title>To-Do</title>
<link rel="icon" href="img/to-do.png">
<img style="display: none;" src="img_avatar2.png" id="randomImage" alt="some image" />
</head>
<body>
<nav>
<ul>
<li title="Home">
<a href="index.php?Notes=Show" class="active">
<i class="material-icons">home</i>
</a>
</li>
<li title="Completed tasks">
<i class="material-icons">done</i>
</li>
<li title="Users">
<a href="index-admin.php">
<i class="material-icons">person</i>
</a>
</li>
<li title="Add Users">
<a href="register.php">
<i class="material-icons">person_add</i>
</a>
</li>
<div class="topnav-right">
<li title="Logout">
<a href="logout.php">
<i class="fa fa-sign-out" style="font-size:25px"></i>
</a>
</li>
</div>
</ul>
</nav>
<div class="dropdown">
<i id="bars" class="fa fa-bars"></i>
<div class="dropdown-content">
<a href="index.php?Notes=Show" class="active">
<i class="material-icons">home</i>
</a>
<i class="material-icons">done</i>
<a href="index-admin.php">
<i class="material-icons">person</i>
</a>
<a href="register.php">
<i class="material-icons">person_add</i>
</a>
<a href="logout.php">
<i class="fa fa-sign-out" style="font-size:25px"></i>
</a>
</div>
</div>
<div class="page-header">
<h1>Hi, <b style="color:#009fe3"> </b>. Welcome.</h1>
</div>
<i style="font-size: 20px; font-style: normal;">Add a task<br>
<!-- form input tasks -->
<div id="form3">
<form method="post" action="index.php?Notes=Show" id="form4">
<i class="material-icons">close</i><br>
<div class="form-group">
<label>Title</label>
<input type="text" maxlength="20" name="task" class="form-control1" placeholder="Title To-Do...">
</div>
<div class="form-group">
<label>Date</label>
<input class="form-control1" type="date" id="dates" name="dates" min="<?php echo $today;?>" value="<?php echo $today;?>">
</div>
<div class="form-group">
<label>Note</label>
<textarea name="note" class="form-control1" rows="10" cols="120" placeholder="Description To-Do..."></textarea><br>
</div>
<div class="form-group">
<button type="submit" name="submit" id="add_btn" class="button">
<i class="fa fa-plus"></i>`
</button>
</div>
</form>
</div>
</form>
<input type="text" id="myInput" autofocus="autofocus" onkeyup="myFunction()" placeholder="Search for anything..." title="Type something to search">
<table id="myTable">
<thead>
<!-- title for table -->
<tr>
<!-- message for no results found -->
<!--<p id="message"></p> -->
<th title="Completed all tasks" class="completeAll">
<a onclick="return checkCompleteAll()" href="#"><i class=material-icons>done</i>ALL</a>
</th>
<th title="Sort By title" id="title" onclick="sortTable(0)">Title
<i id="up"></i>
<i id="down"></i></th>
<th><select class="select" name="note" onchange="location = this.value;">
<option value="index.php?Notes=Show">Show Notes</option>
<option value="index.php?Notes=Hide">Hide Notes</option>
<option value="index.php?Notes=Hide">Hide Notes</option>
<option value="index.php?Notes=Show">Show Notes</option>
</select></th>
</tr>
</thead>
<tbody>
<!-- table content -->
<tr>
<th title="Complete task" class="complete">
<a onclick="return checkComplete('<?=$row['id'] ?>')" href="#"><i class=material-icons>done</i></a>
</th>
<td class="task" style="width: auto;"><b></p>
</td>
<th title="Edit task" class="edit" style="float: right; $color;">
</th>
<td class="date" >
</td>
</tr>
</tbody>
</table>
</body>
<script src="java.js"></script>
</html>
Does your HTML file have a viewport meta tag in its head? It looks like this:
<meta name="viewport" content="width=device-width, initial-scale=1">
Firefox's mobile editor is likely going to ignore this and automatically adjust the scale of the page.
The iPhone screenshot to me looks like Safari is parsing the page in a manner where it doesn't expect the page to be mobile optimised, so basicslly the pixels aren't being adjusted to the viewing distance of the device.
Another thing to consider is that Firefox and Safari do not use the same underlying technology so there could always be variances in end results. That's why it is best to test your websites on as many browsers as possible, which it seems that you have done by testing on a real mobile device.
To read more about the meta viewport tag see Firefox's documentation (it applies to other browsers, too*)
(*Mozilla typically includes a compatibility table if there is an exception or non-standard behavior)
I was trying to make this category search box to fill the heigh of of the menu bar, but I was not able to make it work and be the same height.
How can I achieve this? What I'm missing? Thanks in advance.
Here is the code:
.fa {
line-height: 1em;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: black;
}
/*hack stack-overflow*/
ul::after {
display: block;
clear: both;
content: "";
}
li {
display: inline-block;
}
li.left {
float: left;
border-right: 1px solid white;
}
li.right {
float: right;
border-left: 1px solid white;
}
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li span {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: gray;
}
li span:hover {
background-color: gray;
}
li#login {
position: relative;
}
li#login form {
display: none;
position: absolute;
z-index: 999;
background-color: gray;
padding: 20px;
border-radius: 20px 0px 20px 20px;
right: 0;
box-shadow: 5px 5px 5px black;
}
li#login:hover form {
display: block;
}
input.login_field {
margin: 10px;
}
#submit-div {
text-align: center;
}
#form-wrapper {
width: 100%;
height: 40px;
}
.nav-list {
padding: 10px 25px 10px 5px;
position: relative;
float: left;
border: 1px solid orange;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
#dropdown {
cursor: pointer;
position: absolute;
height: 40px;
left: 0;
top: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
border: 1px solid orange;
}
#dropdown:hover {
background-color: lightgray;
}
.current-selection {
display: inline-block;
font-size: 14px;
}
.in-wrap {
overflow: hidden;
height: 100%;
}
#search-box {
width: 100%;
min-width: 400px;
height: 36px;
border: 1px solid orange;
border-left: none;
border-right: none;
line-height: 25px;
font-size: 18px;
padding-left: 100px;
}
#search-box:focus {
outline: none;
}
.go-button {
float: right;
height: 100%;
background-color: orange;
border: 1px solid orange;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
margin: 0;
padding: 0 15px;
}
.go-button:hover {
background-color: #ff7300;
cursor: pointer;
}
<link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" />
<nav class="menu">
<ul>
<li class="left"><a class="fa fa-home" href="index.jsp"> Home</a>
</li>
<li class="left"><a class="fa fa-shopping-cart" href="#home"> Carrello</a>
</li>
<li class="left"><span id="totale" class="fa fa-money"> €0</span>
</li>
<li id="search" class="left">
<div id="form-wrapper">
<button class="go-button fa fa-search"></button>
<span class="nav-list">
<span class="current-selection">
</span>
<select id="dropdown">
<option value="books-and-ebooks">Books & eBooks</option>
<option value="audiobooks">Audiobooks</option>
<option value="dvds">DVDs</option>
<option value="other-resources">Other Resources</option>
<option value="random">Random</option>
</select>
</span>
<div class="in-wrap">
<input type="text" name="query" id="search-box">
</div>
</div>
</li>
<li class="right"><a class="fa fa-user-plus" href=""> Signup</a>
</li>
<li id="login" class="right">
<a class="fa fa-sign-in" href=""> Login</a>
<form id="login_form" action="login" method="post">
<input id="login_username" class="login_field" name="username" type="text" placeholder="username" />
<br />
<input id="login_password" class="login_field" name="password" type="password" placeholder="password" />
<br />
<div id="submit-div">
<input type="submit" value="login" />
</div>
</form>
</li>
</ul>
</nav>
Well... It seems that your CSS is a bit messy to achieve the rendering you want. If I were you, I'll try to simplify it first...
Moreover, on the provided sample, we can not know the targeted rendering: You want to decrease height of the menu bar, or increase height of the search box?
Below a CSS sample (taken from yours) where search box height is increased to fit the menu bar's height. A not good looking CSS, as a lot of sizes are hardcoded here....
.fa {
line-height: 1em;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: black;
}
/*hack stack-overflow*/
ul::after {
display: block;
clear: both;
content: "";
}
li {
display: inline-block;
}
li.left {
float: left;
border-right: 1px solid white;
}
li.right {
float: right;
border-left: 1px solid white;
}
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li span {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: gray;
}
li span:hover {
background-color: gray;
}
li#login {
position: relative;
}
li#login form {
display: none;
position: absolute;
z-index: 999;
background-color: gray;
padding: 20px;
border-radius: 20px 0px 20px 20px;
right: 0;
box-shadow: 5px 5px 5px black;
}
li#login:hover form {
display: block;
}
input.login_field {
margin: 10px;
}
#submit-div {
text-align: center;
}
#form-wrapper {
width: 100%;
height: 44px;
}
.nav-list {
padding: 5px 25px 5px 5px;
position: relative;
float: left;
border: 1px solid orange;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
#dropdown {
cursor: pointer;
position: absolute;
height: 43px;
left: 0;
top: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
border: 1px solid orange;
}
#dropdown:hover {
background-color: lightgray;
}
.current-selection {
display: inline-block;
font-size: 14px;
}
.in-wrap {
overflow: hidden;
height: 100%;
}
#search-box {
width: 100%;
min-width: 400px;
height: 40px;
border: 1px solid orange;
border-left: none;
border-right: none;
line-height: 25px;
font-size: 18px;
padding-left: 100px;
}
#search-box:focus {
outline: none;
}
.go-button {
float: right;
height: 100%;
background-color: orange;
border: 1px solid orange;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
margin: 0;
padding: 0 15px;
}
.go-button:hover {
background-color: #ff7300;
cursor: pointer;
}