Styling a search box inside a header with CSS - html

I am trying to style a search box inside a header using CSS. Here is a picture of my problem to help try and make things clearer:
When the search box is visible:
So my main problem is when the search box is faded in using JQuery it is taken out of document flow because I am using position: absolute; on .topSearchBarResultWrapper to get the search box where I want it on the header. I have tried using position: relative; which does bring the element .topSearchBarResultWrapper back into flow but does not display the search results below the header.
Thus, when I use position relative I did try and use top: 80px; to bring the search box wrapper down and then use margin-top: -100px; to get rid of the extra white space above, but then when you add search results to the wrapper the top: 80px; is invalid and does not work anymore because the size of .topSearchBarResultWrapper has changed.
I have also made a JsFiddle to help as well: https://jsfiddle.net/jjzp07ey/
Here is my HTML code that I am using:
<header> <!-- HTML 5 header -->
<ul class="navigationBarButtons">
<li>
<a class="topSearchBarButton defaultBlueButton navLoginButton"><img src="images/icons/searchIcon.png"></a>
<div class="topSearchBarResultWrapper">
<input type="text" class="topSearchBarInput" name="topSearchBox" placeholder="Search for someone...">
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
<div class="topSearchBarResult">d</div>
</div>
</li>
<li> <a class="defaultBlueButton" href="profileranks.php">Profile Ranks</a> </li>
<li> <a class="defaultBlueButton" href="howitworks.php">How it Works</a> </li>
</ul>
</header>
And here is the CSS code that I am using:
.topSearchBarInput
{
height: 32px;
width: 300px;
vertical-align: middle;
border: none;
border-radius: 4px;
display: inline-block;
margin-bottom: 4px;
}
.topSearchBarButton img
{
height: 24px;
width: 24px;
display: inline-block;
margin: 0 auto;
vertical-align: middle;
}
.topSearchBarResultWrapper
{
display: inline-block;
height: auto;
background-color: #dad9d5;
border-radius: 4px;
padding-bottom: 5px;
position: absolute;
}
.topSearchBarResult
{
background-color: red;
width: 300px;
height: auto;
}
header
{
background-color: black;
}
header ul
{
height: auto;
padding: 15px 0px;
margin: 0px;
}
header li
{
display: inline;
}
.defaultBlueButton /* Default Button Style */
{
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9); /* Used to support many different browsers */
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 5;
-moz-border-radius: 5;
border-radius: 5px;
font-family: Arial;
color: #ffffff;
font-size: 20px;
padding: 10px 20px 10px 20px;
text-decoration: none;
border: 0px;
}
.defaultBlueButton:hover
{
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); /* Used to support many different browsers */
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
border: 0px;
cursor: pointer;
}

Related

how to make dropdown menu select the option you clicked on last time

as I said in the title I am trying to make my dropdown menu select the last option i clicked on for example:https://www.youtube.com/user/PewDiePie/videos?view=0&sort=dd&flow=grid
in some youtube channels if you select videos and click on SORT BY then choose any option then if you click on sort by again you will see the last option you clicked is selected
(css is internal) this is my code:
html:
<div style="display: inline-block; text-align: right; width: 89%"> <div tabindex="0" class="menu">
<div class="menu-dropdown">
Most Popular
Newest
Oldest
</div>
</div>
</div>
css:
<style>
/* style for the css menu dropdown container */
.menu {
position:relative;
display:inline-block;
z-index:2; padding:0;
margin:0;
outline:0;
text-align:left;
}
/* style for the button */
.menu:before {
content: "\2630 \a0 Menu";
color:white;
padding: 5px 10px;
border: 1px solid #555;
border-radius:3px;
background: #96305e;
background: -moz-linear-gradient(top, #96305e 0%, #822956 10%, #822956 90%, #751749 100%);
background: -webkit-linear-gradient(top, #96305e 0%,#822956 10%,#822956 90%,#751749 100%);
background: linear-gradient(to bottom, #96305e 0%,#822956 10%,#822956 90%,#751749 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#96305e',
endColorstr='#751749',GradientType=0 );
}
.menu:focus { pointer-events:none; }
/* If :focus detected the dropdown menu is displayed by making it visible */
.menu:focus .menu-dropdown { opacity:1; visibility:visible; }
/* style for the dropdown box */
.menu-dropdown {
background-color: #364656;
width: auto;
margin:3px 0 0 0;
padding: 10px;
border-radius:3px;
border:1px black solid;
border-radius:3px;
pointer-events: auto;
position: absolute;
z-index: 1;
opacity: 0;
visibility: hidden;
transition: visibility 1s;
background: #1f8bd3;
background: -moz-linear-gradient(top, #1f8bd3 0%, #1b7aba 10%, #1b7aba 90%, #1b61b7 100%);
background: -webkit-linear-gradient(top, #1f8bd3 0%,#1b7aba 10%,#1b7aba 90%,#1b61b7 100%);
background: linear-gradient(to bottom, #1f8bd3 0%,#1b7aba 10%,#1b7aba 90%,#1b61b7 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1f8bd3',
endColorstr='#1b61b7',GradientType=0 );
}
/* style the links in the dropdown */
.menu-dropdown a {
background:transparent;
border:none;
outline:0;
display:block;
color:white;
text-decoration:none;
width:160px;
padding:5px;
}
</style>
EDIT
Full Html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<div id="header">
<div class="container">
Home
<ul id="header-nav">
<li><a href="about.html" >About</a></li>
<li><a href="contact.html" >Contact</a></li>
<li>Download Links</li>
</ul>
</div>
</div>
<body>
<div style="display: inline-block; text-align: right; width: 89%">
<div tabindex="0" class="menu">
<div class="menu-dropdown">
Most Popular
Newest
Oldest
</div>
</div>
</div>
<style>
/* style for the css menu dropdown container */
.menu {
position:relative;
display:inline-block;
z-index:2; padding:0;
margin:0;
outline:0;
text-align:left;
}
/* style for the button */
.menu:before {
content: "\2630 \a0 Menu";
color:white;
padding: 5px 10px;
border: 1px solid #555;
border-radius:3px;
background: #96305e;
background: -moz-linear-gradient(top, #96305e 0%, #822956 10%, #822956
90%, #751749 100%);
background: -webkit-linear-gradient(top, #96305e 0%,#822956 10%,#822956
90%,#751749 100%);
background: linear-gradient(to bottom, #96305e 0%,#822956 10%,#822956
90%,#751749 100%);
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#96305e', endColorstr='#751749',GradientType=0 );
}
.menu:focus { pointer-events:none; }
/* If :focus detected the dropdown menu is displayed by making it visible
*/
.menu:focus .menu-dropdown { opacity:1; visibility:visible; }
/* style for the dropdown box */
.menu-dropdown {
background-color: #364656;
width: auto;
margin:3px 0 0 0;
padding: 10px;
border-radius:3px;
border:1px black solid;
border-radius:3px;
pointer-events: auto;
position: absolute;
z-index: 1;
opacity: 0;
visibility: hidden;
transition: visibility 1s;
background: #1f8bd3;
background: -moz-linear-gradient(top, #1f8bd3 0%, #1b7aba 10%, #1b7aba
90%, #1b61b7 100%);
background: -webkit-linear-gradient(top, #1f8bd3 0%,#1b7aba 10%,#1b7aba
90%,#1b61b7 100%);
background: linear-gradient(to bottom, #1f8bd3 0%,#1b7aba 10%,#1b7aba
90%,#1b61b7 100%);
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#1f8bd3', endColorstr='#1b61b7',GradientType=0 );
}
/* style the links in the dropdown */
.menu-dropdown a {
background:transparent;
border:none;
outline:0;
display:block;
color:white;
text-decoration:none;
width:160px;
padding:5px;
}
</style>
</body>
<center>
<h1>Games</h1>
<h3>
<a href="https://direct-link.net/165397/script"target="_blank" >Roblox
autorob script</a><br>
8 ball pool hack no root<br>
</h3>
</center>
<div id="footer">
<div class="container">
<div class="column">
<h4>My Links</h4>
<p>
<a href="https://web.facebook.com/YousefRaedXD"
target="_blank">Facebook</a><br>
<a href="https://www.youtube.com/channel/UC6x7kvBibYzem6i59UMc3kw"
target="_blank">Youtube</a>
</p>
</div>
<div class="column">
<h4>My Story</h4>
<p>Hi there! I study in middle school and i wish to be a web programmer
:3</p>
</div>
</div>
</div>
</html>
Full css (external):
#header-nav li {
display: inline;
padding-left: 20px;
}
#header-nav {
display: block;
float:right;
margin-top:0;
}
#header {
background-color: #1abc9c;
height: 150px;
line-height: 150px;
}
container {
max-width:1000px;
margin:0 auto;
}
#header-title {
display: block;
float: left;
font-size: 20px;
font-weight: bold;
}
#header a {
color: white;
text-decoration: none;
text-transform: uppercase;
letter-spacing: 0.1em;
}
#header a:hover {
color: #222;
}
#footer {
background-color: #2f2f2f;
padding: 50px 0;
}
.column {
min-width: 300px
display: inline-block;
vertical-align: top;
}
#footer h4 {
color: white;
text-transform: uppercase;
letter-spacing: 0.1em
}
#footer p {
color:white;
}
a {
color: #1abc9c;
text-decoration: none;
}
a:hover {
color: #F6A623;
}
.post {
max-width: 800px;
margin: 0 auto;
padding: 60px 0;
}
.post-author img {
width: 50px;
height: 50px;
vertical-align: middle;
}
.post-author span {
margin-left: 16px;
}
.post-date {
color: D2D2D2;
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 0.1em;
}
h1, h2, h3, h4 {
color: #333;
}
p {
line-height: 1.5;
}
#import url(http://fonts.googleapis.com/css?family=Montserrat:400,700);
body {
margin: 0;
color: #555;
font-family: 'Montserrat', sans-serif;
}
.post, .about {
max-width: 800px;
margin: 0 auto;
padding: 60px 0;
}
Did you try to use a form in your menu and send by post or get (No matter which one) the last one you picked so, you'll be able to display it with a little bit of php.
<?php
echo"<button>{$_GET['lastOne']}</button>";
?>
!!! Only If I correctly understood the question !!!
What I understood is you want to add, like a history in your dropdown menu and the last button would be a link to the last one you visited
EDIT
Here is the code I told you I would make for you, prob not the best way to do it, but it's working
<div style="display: inline-block; text-align: right; width: 89%">
<div tabindex="0" class="menu">
<div class="menu-dropdown">
Most Popular
Newest
Oldest
<?php
if (isset($_GET['lastButtonClicked']))
{
$lastButtonClicked = $_GET['lastButtonClicked'];
echo"<a href='$lastButtonClicked'>Last button clicked</a>";
}
?>
</div>
</div>
</div>

Unable to apply css style to span within list

So I have quite an interesting issue here. I'd assume it's something I'm just not aware of or there's a mistake/logical issue somewhere. Anyhow long story short I have a html code with a list that is produced by thymeleaf. The idea is to hide a checkbox button behind each list element, which makes it selectable and therefor gives me a quick and easy way to handle the data java's side.
Anyhow my issue however is with the styling of the selector element.
I'm trying to change pointer/color when clicked on. I have added a class into the one span element that is used in my css file as follows. I have tried so many different ways and none of it ever applies it to any of the span elements within my css. However if I simply add style within the span element inside html it works fine. So my question here is, what could be the cause as to why it does not work with the css? Or is it simply something I don't understand yet or may have overlooked?
You can find the code below. Any help is much appreciated!
The one in question is
.minionInputData {
width: 100%;
text-align: center;
margin-top: 3cm;
}
.minionInputs p {
display: inline-block;
float: top;
margin-left: 2cm;
}
.minionContent {
width: 100%;
text-align: center;
margin-bottom: 1cm;
}
.minionInputs {
margin-bottom: 2cm;
}
.rolesTableContainer {
width: 100%;
text-align: center;
}
.roles-table input[type=checkbox] {
vertical-align: middle;
position: relative;
bottom: 1px;
}
.rolesText {
cursor: pointer;
color: red;
display: block;
padding: 10px;
margin: 3px;
}
.roles-table input[type="checkbox"]:checked+span {
color: #ffffff;
font-weight: bold;
background: blue;
}
.argsTableContainer {
width: 100%;
text-align: center;
}
.arguments-table {
/*margin: 0 0 0 auto;*/
display: inline-block;
width: 40%;
border: 3px solid green;
padding: 10px;
overflow:hidden;
}
.arguments {
width: 100%;
}
.arguments table {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
.arguments td {
padding: 8px;
border-style:outset;
background-color: #4CAF50;
height: 100%;
}
.arguments td input{
border: 0;
box-shadow: none;
width:100%;
height:40px;
font-size:26px;
white-space:nowrap;
background-color: #4CAF50;
text-align: center;
}
.arguments tr:nth-child(even){
background-color: #ffffcc;
}
.arguments tr:hover {
background-color: #ddd;
}
.addrowbutton {
float: right;
top: 200px;
}
/*.addallarguments {
background: #ff0000;
background-image: -webkit-linear-gradient(top, #ff0000, #3f219e);
background-image: -moz-linear-gradient(top, #ff0000, #3f219e);
background-image: -ms-linear-gradient(top, #ff0000, #3f219e);
background-image: -o-linear-gradient(top, #ff0000, #3f219e);
background-image: linear-gradient(to bottom, #ff0000, #3f219e);
-webkit-border-radius: 28;
-moz-border-radius: 28;
border-radius: 28px;
text-shadow: 1px 1px 3px #666666;
font-family: Arial;
color: #ffffff;
font-size: 20px;
padding: 10px 20px 10px 20px;
text-decoration: none;
}
.addallarguments:hover {
background: #311ebd;
background-image: -webkit-linear-gradient(top, #311ebd, #3498db);
background-image: -moz-linear-gradient(top, #311ebd, #3498db);
background-image: -ms-linear-gradient(top, #311ebd, #3498db);
background-image: -o-linear-gradient(top, #311ebd, #3498db);
background-image: linear-gradient(to bottom, #311ebd, #3498db);
text-decoration: none;
}
.confirmButtons{
text-align: center;
width:100%;
bottom:0;
}*/
.confirmButtons input{
-moz-box-shadow: 1px 2px 5px 0px #899599;
-webkit-box-shadow: 1px 2px 5px 0px #899599;
box-shadow: 1px 2px 5px 0px #899599;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #a1a1a1));
background:-moz-linear-gradient(top, #ededed 5%, #a1a1a1 100%);
background:-webkit-linear-gradient(top, #ededed 5%, #a1a1a1 100%);
background:-o-linear-gradient(top, #ededed 5%, #a1a1a1 100%);
background:-ms-linear-gradient(top, #ededed 5%, #a1a1a1 100%);
background:linear-gradient(to bottom, #ededed 5%, #a1a1a1 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#a1a1a1',GradientType=0);
background-color:#ededed;
-moz-border-radius:13px;
-webkit-border-radius:13px;
border-radius:13px;
display:inline-block;
cursor:pointer;
color:#121212;
font-family:Verdana;
font-size:16px;
font-weight:bold;
padding:16px 25px;
text-decoration:none;
text-shadow:0px 0px 0px #e1e2ed;
}
.confirmButtons input:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #a1a1a1), color-stop(1, #ededed));
background:-moz-linear-gradient(top, #a1a1a1 5%, #ededed 100%);
background:-webkit-linear-gradient(top, #a1a1a1 5%, #ededed 100%);
background:-o-linear-gradient(top, #a1a1a1 5%, #ededed 100%);
background:-ms-linear-gradient(top, #a1a1a1 5%, #ededed 100%);
background:linear-gradient(to bottom, #a1a1a1 5%, #ededed 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#a1a1a1', endColorstr='#ededed',GradientType=0);
background-color:#a1a1a1;
}
.confirmButtons input:active {
position:relative;
top:1px;
}
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<title>Minions configurations</title>
<h1 align="center">Minion configuration</h1>
</head>
<body background="../static/images/MainBackground.jpg" th:background="#{images/MainBackground.jpg}">
<div id="allRolesContent">
<form action="#" th:action="#{/minions}" th:object="${selectedRole}" method="post">
<select id="allRoles" th:field="*{roleName}">
<option th:each="roleObj : ${allMinionRoles}"
th:value="${roleObj.getRoleName()}"
th:text="${roleObj.getRoleName()}">ROLES
</option>
</select>
<p><input type="submit" name="addRole" value="Add Formula" /></p>
</form>
</div>
<div id="minionForm" class="minionForm">
<link rel="stylesheet" type="text/css" href="../static/css/minions.css" th:href="#{css/minions.css}"/>
<script src="../static/js/buttons.js" th:src="#{js/buttons.js}"></script>
<script src="../static/js/PageFunctions" th:src="#{js/PageFunctions}"></script>
<div id="minionContent" class="minionContent">
<form action="#" th:action="#{/minions}" th:object="${minions}" method="post">
<div id="minionInputs" class="minionInputs">
<p>Configuration Name: <input type="text" th:field="*{name}" th:required="required"/></p>
<p>Enironment(eg LABOR): <input type="text" th:field="*{env}" th:required="required"/></p>
</div>
<div class="rolesTableContainer">
<div class="roles-table">
<ul>
<li style="list-style-type: none;" th:each="role : ${currentMinionRoles}">
<label th:field="*{roleName}" th:value="${role.getRoleName()}">
<span class="rolesText" th:text="test">ROLE</span>
<input type="checkbox" th:field="*{roleName}" th:value="${role.getRoleName()}"/>
</label>
</li>
</ul>
<input type="submit" name="remove" value="Remove" formnovalidate="formnovalidate"/>
<button name="moveUP" formnovalidate="formnovalidate">&ShortUpArrow;</button>
<button name="moveDown" formnovalidate="formnovalidate">&ShortDownArrow;</button>
</div>
</div>
<div class="argsTableContainer">
<div class="arguments-table">
<table id="argsTable" class="arguments">
<h1 align="center">Arguments list</h1>
<input class="addrowbutton" type="submit" name="add" value="Add Argument" formnovalidate="formnovalidate" onclick="addRow('argsTable','argumentTr')"
th:onclick="'addRow(\'argsTable\',\'argumentTr\');'"/>
<tr>
<th>Argument Name</th>
<th>Value</th>
</tr>
<tr id="argumentTr" th:each="argument : *{arguments}">
<td>
<input type="text" th:value="${argument.argName}" id="argName" name="argName"/>
</td>
<td>
<input type="text" th:value="${argument.value}" id="value" name="value"/>
</td>
</tr>
</table>
</div>
</div>
<div class="confirmButtonsContainer">
<div class="confirmButtons">
<input type="submit" name="saveAll" value="Save Configuration" />
<input type="submit" name="updateConf" value="Update Configuration"/>
</div>
</div>
</form>
</div>
</div>
</body>
</html>
I'm not sure if you are looking for something like this, cus I could not understand quite clear. I made a simple example with jQuery. So, if your list is checked, it will add another class to that span, and this span will take style from stylesheet file, not just if you add inline style.
P.S, you could do this with css too, without jQuery, but I did not change your code structure, so I had to do a simple demo with jQuery.
Hope this helps you!
$("input").on("change", function(){
var _this = $(this);
var checkboxElement = _this.parent().find(".rolesText");
if(_this.is(':checked')) {
checkboxElement.addClass("checked");
}
else {
checkboxElement.removeClass("checked");
}
})
.roles-table input[type=checkbox] {
vertical-align: middle;
position: relative;
bottom: 1px;
}
.rolesText {
cursor: pointer;
color: red;
display: inline-block;
padding: 10px;
margin: 3px;
}
.rolesText.checked {
color: blue;
font-weight: bold;
}
.roles-table input[type="checkbox"]:checked {
color: #ffffff;
font-weight: bold;
background: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script>
<div class="rolesTableContainer">
<div class="roles-table">
<ul>
<li style="list-style-type: none;" th:each="role : ${currentMinionRoles}">
<label th:field="*{roleName}" th:value="${role.getRoleName()}">
<span class="rolesText" th:text="${role.getRoleName()}">Role Name Here</span>
<input type="checkbox" th:field="*{roleName}" th:value="${role.getRoleName()}"/>
</label>
</li>
<li style="list-style-type: none;" th:each="role : ${currentMinionRoles}">
<label th:field="*{roleName}" th:value="${role.getRoleName()}">
<span class="rolesText" th:text="${role.getRoleName()}">Role Name Here</span>
<input type="checkbox" th:field="*{roleName}" th:value="${role.getRoleName()}"/>
</label>
</li>
<li style="list-style-type: none;" th:each="role : ${currentMinionRoles}">
<label th:field="*{roleName}" th:value="${role.getRoleName()}">
<span class="rolesText" th:text="${role.getRoleName()}">Role Name Here</span>
<input type="checkbox" th:field="*{roleName}" th:value="${role.getRoleName()}"/>
</label>
</li>
</ul>
<input type="submit" name="remove" value="Remove" formnovalidate="formnovalidate"/>
<button name="moveUP" formnovalidate="formnovalidate">&ShortUpArrow;</button>
<button name="moveDown" formnovalidate="formnovalidate">&ShortDownArrow;</button>
</div>
</div>
Cascading styles sheets are as they sound - cascading so you cannot go backwards or upwards, only forwards and downwards. If you want to style something if the checkbox is checked, place it after the checkbox and use a sibling selector - either + or ~:
.roles-table input[type=checkbox] {
vertical-align: middle;
position: relative;
bottom: 1px;
}
.rolesText {
cursor: pointer;
color: red;
display: block;
padding: 10px;
margin: 3px;
}
.roles-table input[type="checkbox"]:checked+span {
/* this means the span that directly follows a checked input */
color: #ffffff;
font-weight: bold;
background: blue;
}
/* if you need the span to appear first, use the following */
label {
display: flex;
align-items: center;
}
label>span {
order: 1;
}
label>input {
order: 2;
}
<div class="rolesTableContainer">
<div class="roles-table">
<ul>
<li style="list-style-type: none;" th:each="role : ${currentMinionRoles}">
<label th:field="*{roleName}" th:value="${role.getRoleName()}">
<input type="checkbox" th:field="*{roleName}" th:value="${role.getRoleName()}"/>
<span class="rolesText" th:text="${role.getRoleName()}">test</span>
</label>
</li>
</ul>
<input type="submit" name="remove" value="Remove" formnovalidate="formnovalidate" />
<button name="moveUP" formnovalidate="formnovalidate">&ShortUpArrow;</button>
<button name="moveDown" formnovalidate="formnovalidate">&ShortDownArrow;</button>
</div>
</div>

Firefox button gets bigger

I have a button and an anchor tag booth using the same class, but the button gets bigger for some reason. I found a question here already solved but it still is a little bit bigger than the other.
HTML:
<div class="item-actions">
<ul>
<li><i class="fa fa-trash"></i> Gravar</li>
<li><button type="submit" class="button"><i class="fa fa-trash"></i> Lixo</button></li>
</ul>
</div>
CSS:
.item-actions{
float: right;
}
.item-actions ul li{
display: inline-block;
}
.button {
background: #3a9665;
background-image: -webkit-linear-gradient(top, #3a9665, #2d7a51);
background-image: -moz-linear-gradient(top, #3a9665, #2d7a51);
background-image: -ms-linear-gradient(top, #3a9665, #2d7a51);
background-image: -o-linear-gradient(top, #3a9665, #2d7a51);
background-image: linear-gradient(to bottom, #3a9665, #2d7a51);
-webkit-border-radius: 2;
-moz-border-radius: 2;
border-radius: 2px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
padding: 4px 12px 4px 12px;
border: solid #2d7a51 1px;
text-decoration: none;
}
.button:hover {
background: #2d7a51;
text-decoration: none;
}
Here I found a Solution so I added this bit of CSS:
button::-moz-focus-inner {
padding: 0;
border: 0
}
But the result still isn't what I want, you will notice some difference in the following screenshot:
EDIT:
I've removed i tags and the problem still exists, so thats not the problem.
I can recreate the issue on Mac OS X 10.9.5 with FireFox version 32.0.2. Adding line-height: 1em; to .button seems to work when I test it in FireFox:
.button {
background: #3a9665;
background-image: -webkit-linear-gradient(top, #3a9665, #2d7a51);
background-image: -moz-linear-gradient(top, #3a9665, #2d7a51);
background-image: -ms-linear-gradient(top, #3a9665, #2d7a51);
background-image: -o-linear-gradient(top, #3a9665, #2d7a51);
background-image: linear-gradient(to bottom, #3a9665, #2d7a51);
-webkit-border-radius: 2;
-moz-border-radius: 2;
border-radius: 2px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
line-height: 1em;
padding: 4px 12px 4px 12px;
border: solid #2d7a51 1px;
text-decoration: none;
}
I believe the issue’s cause comes from <button type="submit" class="button"> tag having explicit styling while your <a href="#" class="button"> doesn’t:
<div class="item-actions">
<ul>
<li><i class="fa fa-trash"></i> Gravar</li>
<li><button type="submit" class="button"><i class="fa fa-trash"></i> Lixo</button></li>
</ul>
</div>
Also could be caused by the use of explicit pixel sizing in .button with font-size: 12px;. I would recommend using another scheme for sizing such as em’s or even percentages.
try to set the line-height of icons to 1:
.fa {
line-height: 1;
}

Search Box within Navigation bar alignment issue

Hey i'm just learning programming and im trying to have my search bar always centered with the nav links to the right of it with-in the fixed navigation bar. I just can't seem to make it work. Here is my html and css. I appreciate the help!
<div id ="nav">
<div id ="navigation">
<container id= "search">
<form class="form-wrapper cf">
<form action ='./search.php' method='get'>
<input type="text" placeholder="" required>
<button type="submit"><img class= "icon" src="images/search-icon.png"></button>
</form>
</container>
<div>
Home
About
Contact
Login
</div>
</div>
</div>
And my CSS:
#nav {
display: block;
position: fixed;
top: 0;
width: 100%;
height: 28px;
padding: 12px 0px 0px 0px;background: #4c4c4c; /* Old browsers */
background: #4c4c4c; /* Old browsers */
background: -moz-linear-gradient(top, #4c4c4c 0%, #1c1c1c 90%, #131313 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4c4c4c), color-stop(90%,#1c1c1c), color-stop(100%,#131313)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #4c4c4c 0%,#1c1c1c 90%,#131313 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #4c4c4c 0%,#1c1c1c 90%,#131313 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #4c4c4c 0%,#1c1c1c 90%,#131313 100%); /* IE10+ */
background: linear-gradient(to bottom, #4c4c4c 0%,#1c1c1c 90%,#131313 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 ); /* IE6-9 */
/* Adds shadow to the bottom of the bar */
-webkit-box-shadow: 0px 0px 8px 0px #000000;
-moz-box-shadow: 0px 0px 8px 0px #000000;
box-shadow: 0px 0px 8px 0px #000000;
/* Adds the transparent background */
background-color: rgba(1, 1, 1, 0.8);
color: rgba(1, 1, 1, 0.8);
}
#nav a {
font-size: 12px;
padding-right: 60px;
color: white;
text-decoration: none;
}
#nav a:hover {
color: grey;
}
#navigation {
display: inline;
text-align: center;
}
#search {
position: absolute;
top: 5px;
}
I would move the search form into the middle of the navigation menu. Check out this fiddle: http://jsfiddle.net/DJa25/8/
<div id ="nav">
<div id ="navigation">
<div>
Home
About
<container id= "search">
<form class="form-wrapper cf">
<form action ='./search.php' method='get'>
<input type="text" placeholder="" required>
<button type="submit"><img class= "icon" src="images/search-icon.png"></button>
</form>
</container>
Contact
Login
</div>
</div>
#search {
display: inline-block;
}
Firstly I have never heard of a container tag, unless I'm missing something.
Secondly you cannot wrap a form onto a form. So take out the wrapping form. Plus the form tag with the action and method attribute does not have a closing tag so include it.
<div id="navigation">
<form class="nav-form">
<input type="text" required>
<button type="submit">Submit</button>
</form>
<nav>
<ul>
<li>Home</li>
<li>Home2</li>
<li>Home3</li>
<li>Home4</li>
</ul>
</nav>
</div>
then include this css
#navigation {
top:0;
position:fixed;
display:block;
width:100%;
height:28px;
}
.nav-form{
margin:0 auto;
float:left;
}
nav {
float:left;
}
nav ul li {
float:left;
list-style-type:none;
text-decoration:none;
}
Hope this helped.
There may be an issue with margin:0 auto in which it won't center. If this happens do this:
margin-left;auto;
margin-right:auto;
or if that doesn't work:
margin-left:50%;
You can add your backgrounds and stuff after and can change the css around for your needs. I just done it the way it should work

Style form input login

I want to write CSS and HTML to made this input forum from a psd file
I have few questions to ask:
First of all I cutted the background (without the other graphic elements). The header is simple to style. With the input text I found difficult: I would that when an user click over the rectangle, the text and the icon disappear.
this is my css code:
input{
background: url('input-bg.png') no-repeat;
border: none;
width: 303px;
height: 36px;
}
#username{
background: url('user-icon.png') no-repeat left;
}
#password{
background: url('password-icon.png') no-repeat left;
}
where input-bg.png is the following image:
<div id="form-login"><img id="member-icon" src="member-icon.png" />
<h2>Member login</h2>
<ul>
<li><input type="text" id="username" placeholder="User Name"/></li>
<li><input type="password" id="password" placeholder="Password" /></li>
</ul>
</div>
The problem is that the small icons are not showed because the background define of the input text overwite they. There is a simple way so solve this?
There is a simple way to reproduce also the glow effect on the right? i thought about put the effect with a value of the z-index highter than the other elements, but obviously there is a problem if you click over the button or the inputtext in the right of the form. Any suggestion?
I was thinking if its actually possible to make this form in CSS widthgradient, so I gave it a try.
Here's the result: Demo
Its not exactly like the form in picture, byt hey! I am no web designer.
And with some improvements from some CSS genius, you can make it look exactly like the one in picture.
Replace ? icon with the one you want.
HTML
<div class="container"> <!-- Unnecessary tag -->
<div class="form">
<div class="header">
Member Login
</div>
<div class="body">
<form>
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<input id="rememberme" type="checkbox">
<label for="rememberme">Remember</label>
<input type="submit" value="Login Now">
</form>
</div>
</div>
</div>
CSS
body {
font-family: helvetica, sans-serif;
}
#font-face {
font-family: 'icons';
src: url('icons.ttf') format('truetype');
}
div, input {
box-sizing: border-box;
}
.container {
width: 500px;
height: 350px;
padding: 35px 0;
background: -webkit-linear-gradient(left, #C2DD9A, #F5FBF0 50%, #C2DD9A);
}
.form {
width: 365px; height: 274px;
margin: auto;
background: rgba(0,0,0,.23);
padding: 2px;
}
.header {
height: 44px;
line-height: 44px;
padding-left: 30px;
font-size: 20px;
background: url('http://i.imgur.com/s0O9hy0.png') 325px center no-repeat, -webkit-linear-gradient(top, rgb(253,253,253), rgb(198,203,199));
}
form {
margin: 0 31px;
}
input[type=text], input[type=password] {
display: block;
width: 100%;
height: 38px;
padding-left: 38px;
background: url('http://i.imgur.com/s0O9hy0.png') 10px center no-repeat, -webkit-linear-gradient(45deg, #404040 0%, #404040 60%, #535353 60%, #494949);
color: #AAA;
border: 1px solid black;
transition: box-shadow .3s;
}
input[type=text]:focus, input[type=password]:focus {
outline: 0;
box-shadow: inset 0 0 8px rgba(226,239,207,.7);
}
input[type=text] { margin-top: 36px; margin-bottom: 26px; }
input[type=password] { margin-bottom: 36px; margin-top: 26px; }
input[type=checkbox] {
-webkit-appearance: none;
width: 11px; height: 11px;
border-radius: 10px;
background: rgba(0,0,0,.5);
margin: 0 5px;
}
input[type=checkbox]:checked {
background: -webkit-radial-gradient(center center, circle, white 0%, white 30%, rgba(0,0,0,.5) 50%);
}
input[type=checkbox] + label {
color: white;
font-size: 15px;
padding-bottom: 3px;
}
input[type=submit] {
float: right;
width: 134px; height: 31px;
border: 1px solid #B7DA7C;
background: url('http://i.imgur.com/s0O9hy0.png') 15px center no-repeat, -webkit-linear-gradient(top, #99CC4B, #73A52C);
font-weight: bold;
color: white;
text-align: right;
padding-right: 22px;
}
input[type=submit]:active {
box-shadow: inset 0 -3 5px rgba(0,0,0,.5);
background: -webkit-linear-gradient(top, #649126, #7DB731);
}
what about using a before statement?
input#username:before{
content: url('user-icon.png');
}
http://www.w3schools.com/cssref/sel_before.asp
the easiest solution would be to add both icon and glow style into input background (different for each input) and then add padding-left to input. KISS rule ;)
Cut out the shade only and make it an absolute positioned div with right: 0; (assuming parent is the form box)
Since elements under the shade box won't be clickable (You will have an rectangle to show triangle), you will have to make invisible divs OVER shade box that will focus input boxes on click.
Order of z-index would be like this:
Input boxes
Shade box
Invisible divs to send focus to input boxes on click
That's what comes first to my mind.