Search Box within Navigation bar alignment issue - html

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

Related

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>

Navigation Hover/Active Box aren't covering the contents

I already tried searching all over Stack Overflow and unfortunately didn't find any possible solution thus I decided to post a question.
So I was using bootstrap 3 for the first time and I uses their navigation style, the .navbar .navbar-default and they have there own height which make the .active class on the bootstrap able to cover the whole navigation, but in my case I modify and create a new class and called it .own-navbar I added this css
.own-navbar{
height: 68px;
background: #ffffff;
background: -moz-linear-gradient(top, #ffffff 0%, #e2e2e2 48%, #cccccc 50%, #eaeaea 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(48%,#e2e2e2), color-stop(50%,#cccccc), color-stop(100%,#eaeaea));
background: -webkit-linear-gradient(top, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
background: -o-linear-gradient(top, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
background: -ms-linear-gradient(top, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
background: linear-gradient(to bottom, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eaeaea',GradientType=0 );
}
and made a lot of changes and here's my navigation bar looks like
http://i.stack.imgur.com/EXx4H.png
As you guys see it, the .active class on bootstrap 3 isn't covering the whole thing. So how can I fix it?
Here's my full HTML code
<!DOCTYPE html>
<html lang="en">
<head>
<title>sWIFI - Free Wifi Hotspot!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<!-- SCRIPT -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</head>
<body>
<!-- NAVIGATION BAR -->
<div class="container">
<nav class="navbar navbar-default own-navbar">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="img/se" class="se" title="Free Wifi Hotspot" />
<h6>se</h6>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><img src="img/seperator.png" /></li>
<li class="active"><a class="red"href="#">HOME</a></li>
<li><img src="img/seperator.png" /></li>
<li>ABOUT</li>
<li><img src="img/seperator.png" /></li>
<li>CONTACT US</li>
<li><img src="img/seperator.png" /></li>
</ul>
<div class="search navbar-right">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
<div class="input-group-btn">
<button class="btn btn-default search-btn" type="submit">Go!</button>
</div>
</div>
</form>
</div>
</div>
</div>
</nav>
</div>
<!-- END OF NAVIGATION BAR -->
</body>
</html>
and my full CSS Code
/** CSS STYLING SPECIALLY MADE FOR sWIFI and CODED by urielD3 **/
/** Defaults **/
body{
background-color: #f6f6f6;
}
/** NAVIGATION BAR & MENU **/
.own-navbar{
height: 68px;
background: #ffffff;
background: -moz-linear-gradient(top, #ffffff 0%, #e2e2e2 48%, #cccccc 50%, #eaeaea 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(48%,#e2e2e2), color-stop(50%,#cccccc), color-stop(100%,#eaeaea));
background: -webkit-linear-gradient(top, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
background: -o-linear-gradient(top, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
background: -ms-linear-gradient(top, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
background: linear-gradient(to bottom, #ffffff 0%,#e2e2e2 48%,#cccccc 50%,#eaeaea 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eaeaea',GradientType=0 );
}
.own-navbar .container-fluid .navbar-header .se{
margin: 2px 0px 0px 5px;
}
.own-navbar .container-fluid .navbar-header h6{
font-family: Verdana;
font-size: 12px;
color: #363636;
font-weight: bold;
text-shadow: 1px 1px 2px #7A7A7A;
margin: -6px 0px 0px 55px;
cursor: default;
}
li:hover{
/* margin: -7px 0 0 0;
height: 68px; */
background: #f3f3f3;
background: -moz-linear-gradient(top, #f3f3f3 0%, #f1f1f1 53%, #e1e1e1 53%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f3f3f3), color-stop(53%,#f1f1f1), color-stop(53%,#e1e1e1), color-stop(100%,#ffffff));
background: -webkit-linear-gradient(top, #f3f3f3 0%,#f1f1f1 53%,#e1e1e1 53%,#ffffff 100%);
background: -o-linear-gradient(top, #f3f3f3 0%,#f1f1f1 53%,#e1e1e1 53%,#ffffff 100%);
background: -ms-linear-gradient(top, #f3f3f3 0%,#f1f1f1 53%,#e1e1e1 53%,#ffffff 100%);
background: linear-gradient(to bottom, #f3f3f3 0%,#f1f1f1 53%,#e1e1e1 53%,#ffffff 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f3f3f3', endColorstr='#ffffff',GradientType=0 );
}
.asd{
color: red;
}
.own-navbar .container-fluid div ul{
margin: 7px 0px 0px 65px;
}
.own-navbar .container-fluid div ul li a{
color: #3B3B3B;
font-size: 15px;
font-family: Verdana;
font-weight: bolder;
}
.own-navbar .container-fluid div ul li img{
margin: -8px 0 0 0;
}
.own-navbar .container-fluid div .search form input{
border-radius: 20px;
width: 305px;
margin: 6px 0 0 0;
}
.own-navbar .container-fluid .search form .search-btn{
border-radius: 20px;
margin: 3px 0 0 15px;
}
Edit:
Click me for the Actual Website
#Christina is correct, but possibly a more direct answer to your question is you set your .own-navbar height to 68, but that isn't really doing what you want. Your separator image height is 68px so your navbar is already at the image height. The use of the image in the menu nav list will cause problems when the navbar collapse class is added on smaller screens.
You could use:
ul.nav.navbar-nav li {
height: 68px;
}
to try to fix the button height, but that will lead to still other issues.
You could remove the separator image and use css to create separators between buttons. The following rule is going to cause additional problems as well.
.own-navbar .container-fluid div ul {
margin: 7px 0 0 65px;
}
That 7px top margin will give you headaches. Adjust height with line height or padding as Christina suggested. You can solve the left margin problem by setting min-width on div.navbar-header.
Let Bootstrap determine the final nav dimensions, responsive behavior will work better that way.

Basic styling bits surprisingly not being applied

Having applied styling to my form certain elements of the form aren't adhering to the styling particularly:
1st issue: The width of 350px is only being applied on one of the five input elements i.e. the email field.
2nd issue: I'm applying an image on the input elements when engaged to indicate they are required but the image isnt appearing on any of the input elements when engaged.
3rd issue: I would like the div with the class social_sign_in to have a margin top which I have applied but isn't working.
4th issue: I'm attempting to have the form styling i.e. the class I call form_input_div to wrap itself round the form elements which are 350px in width whilst it remains in the centre. This seems not to be working.
As am slightly new to CSS I suspect I might have made some errors in the basics of styling so my apologies if that is the case.
EDIT: Here's the relevant HTML code:
<div class="page_content_main_div">
<div class="page_content_heading_div" >
<p> Log in with: </p>
</div>
<div class="social_sign_in_div">
<a class="btn-auth btn-facebook large" href="#">Log in with <b>Facebook</b></a>
</div>
<div class="social_sign_in_div">
<a class="btn-auth btn-google large" href="#">Log in with <b>Google</b></a>
</div>
<div class="btn_log_in_with_email_div">
<a class="btn-auth btn_log_in_with_email large" href="#">Log in with <b>ABCD details</b></a>
</div>
<hr class="hr"></hr>
<form action="#" method="GET" class="sign_up_form">
<div class="page_content_heading_div">
<p>Sign up:</p>
</div>
<div>
<input title="Enter first name" class="firstname" name="firstname" type="text" required placeholder="Enter first name">
</div>
<div>
<input title="Enter second name" class="secondname" name="secondname" type="text" required placeholder="Enter second name">
</div>
<div>
<input title="Enter your e-mail" class="email" name="email" type="email" required placeholder="Enter email">
</div>
<div>
<input title="Enter a password" class="password" name="password" type="password" required placeholder="Enter password">
</div>
<div>
<input title="Re-enter password" class="reenterpassword" name="reenterpassword" type="password" required placeholder="Re-enter password">
</div>
<div class="form_button_internal_div">
<button title="Type your second name" type="submit" class="btn_sign_up">Sign Up</button>
</div>
<div class="form_terms_of_service_internal_div">
<p class="terms_of_service">By signing up, I agree to the ABCD <b>Terms of Service</b> and <b>Privacy Policy</b>.</p>
</div>
</form>
</div>
EDIT: Here's the relevant CSS code:
/* Page content heading div */
.page_content_heading_div {
font-family:'Trebuchet MS', Tahoma, Sans-serif;
color: #999999;
font-size: 40px;
font-weight: bold;
clear: both;
}
/* Page content main div */
.page_content_main_div {
clear: both;
}
/* Social sign in div */
.social_sign_in_div {
font-family:'Trebuchet MS', Tahoma, Sans-serif;
clear: both;
margin-top: 10px;
}
/* Log in with email div */
.btn_log_in_with_email_div {
font-family:'Trebuchet MS', Tahoma, Sans-serif;
clear: both;
margin-top: 10px;
}
/* hr styling */
.hr {
width: 350px;
height: 2px;
background: #333;
background-image: -webkit-linear-gradient(left, #ccc, #333, #ccc);
background-image: -moz-linear-gradient(left, #ccc, #333, #ccc);
background-image: -ms-linear-gradient(left, #ccc, #333, #ccc);
background-image: -o-linear-gradient(left, #ccc, #333, #ccc);
}
/* */
.sign_up_form {
width: 350px;
display: inline-block;
}
/* */
input[type="text"], input[type="password"], input[type="email"] {
font-family:'Trebuchet MS', Tahoma, Sans-serif;
width: 100%;
height: 45px;
font-size: 20px;
color: #000000;
border: 1px solid #999999;
border-radius: 6px;
padding: 5px 5px 5px 5px;
margin-top: 10px;
-webkit-appearance: none;
-moz-appearance: none;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
}
/* */
input:focus {
outline: solid #999999;
border-radius: 6px;
}
/* */
.form_button_internal_div {
margin-top: 10px;
margin-bottom: 10px;
}
/* Primary button */
.btn_sign_up {
right: 0px;
width: 150px;
height: 36px;
border:none;
font-weight: normal;
font-size: 20px;
margin-top: 10px;
background: #CCC;
background: -webkit-linear-gradient(#A2E55A,#A2E55A 50%,#A2E55A 51%,#A2E55A);
background: -moz-linear-gradient(#A2E55A,#A2E55A 50%,#A2E55A 51%,#A2E55A);
background: -ms-linear-gradient(#A2E55A,#A2E55A 50%,#A2E55A 51%,#A2E55A);
background: -o-linear-gradient(#A2E55A 0%,#A2E55A 50%,#A2E55A 51%,#A2E55A);
background: linear-gradient(#A2E55A,#A2E55A 50%,#A2E55A 51%,#A2E55A);
-pie-background: linear-gradient(#A2E55A,#A2E55A 50%,#A2E55A 51%,#A2E55A);
-webkit-border-radius: 4px 4px 4px 4px;
-moz-border-radius: 4px 4px 4px 4px;
border-radius: 4px 4px 4px 4px;
-webkit-box-shadow: inset 1px 0 0px rgba(255,255,255,.4);
-moz-box-shadow: inset 1px 0 0px rgba(255,255,255,.4);
box-shadow: inset 1px 0 0px rgba(255,255,255,.4);
color: #F5F5F5;
}
/* */
.btn_sign_up:hover {
background: -webkit-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: -moz-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: -ms-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: -o-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
-pie-background: linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
}
/* */
.btn_sign_up:active {
background: -webkit-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: -moz-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: -ms-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: -o-linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
background: linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
-pie-background: linear-gradient(#71A03F,#71A03F 50%, #71A03F 51%);
}
/* */
.form_terms_of_service_internal_div {
margin-top: 10px;
margin-bottom: 10px;
}
/* */
.terms_of_service {
font-family:'Trebuchet MS', Tahoma, Sans-serif;
font-size: 15px;
color: #999999;
}
The width of 350px is only being applied on one of the five input elements i.e. the email field.
This doesn't seem to be true...I'm seeing all inputs the same length.
I'm applying an image on the input elements when engaged to indicate they are required but the image isnt appearing on any of the input elements when engaged.
Your engaged inputs are identified by the class required, but they all have this class by default, so there really isn't a trigger. What you are looking for is a :focus, then apply the styling.
I would like the div with the class social_sign_in to have a margin top which I have applied but isn't working.
It's working, but 10px is not enough to see a difference. If you made this like 50px, you will see it moved.
I'm attempting to have the form styling i.e. the class I call form_input_div to wrap itself round the form elements which are 350px in width whilst it remains in the centre. This seems not to be working.
What purpose does the form_input_div serve? Why not remove the widths from the input, have them take 100% of their container, which is the form, and set the width on the form with some padding and you'll get what you want.
Also, required id is not a valid attribute to be putting on the input tags.

The Html ordered List is displaying in next line

I have used html and css code below My aim is to display master,image and list in single line.but list is displaying in next line so pls help me to rectify the issue.
HTML
<h2> Master <img src="<?php echo base_url('img/courses_title.jpg'); ?>" HEIGHT="55" WIDTH="55" BORDER="0" /><div align="center"> <ul class="Data"><li> 1.Course code and name is created </li></ul></h2>
CSS
<style type="text/css">
.pg-normal {
color: green;
font-weight: normal;
text-decoration: none;
cursor: pointer;
background: #e3e3e3;
border: 1px solid #cac9c9;
padding: 4px 7px;
}
.pg-selected {
color: black;
font-weight: bold;
text-decoration: underline;
cursor: pointer;
}
.Data {
width:20%;
margin: 10px;
-moz-border-radius : 10px; /* Firefox */
-webkit-border-radius : 10px; /* Safari & Chrome */
-khtml-border-radius : 10px; /* Linux browsers */
border-radius : 10px; /* CSS3 compatible browsers */
border-style: solid;
border-width: 1px;
border-color: #cccccc;
padding: 0px;
border-spacing: 0px;
overflow: hidden;
background: #eeeeee; /* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
}
</style>
Please take a look at this JsFiddle.
I have added an example based off your above HTML, here is the HTML code:
<h2>Master</h2>
<img src="/path/" alt="example" />
<ul>
<li>1. Course code and name is created</li>
</ul>
CSS:
img, ul {
float: left;
}
ul {
margin: 0;
}
It's displaying in the next line because it is a block element.
Most HTML elements are defined as block level elements or as inline
elements.
Block level elements normally start (and end) with a new line when
displayed in a browser.
Inline elements are normally displayed without starting a new line.
That is the main concept, as to why your li appears on separate lines.
if you want your li element to appear on the same line, you'll have to implement it in the inline form, like so:
<li style="display:inline;">content</li>
if you want all your lis to be inline do this:
<style>
li{
display:inline;
}
<style>
just add it to the head section of your page.
try this one
http://jsfiddle.net/nY6eu/1/
add this to your code
css file:
.ul{
list-style:none;
}
.ul li{
display:inline-block;
}
html file:
<ul class="ul"><li><h2> Master </h2></li>
<li><img src="http://img.talkandroid.com/uploads/2013/03/wpid-photo-jan-14-2013-1115-am.jpg" HEIGHT="55" WIDTH="55" BORDER="0" /></li> <li class="Data"> 1.Course code and name is created </li>
</ul>

How do I align the position of the text in the nav bar?

What is being shown now.
I want the text in the nav bar to be more aligned towards the center of the white bar and the menu icon to be aligned with the word "Menu" .
Any guidance is appreciated.
HTML code :
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title> Foodstant Delivery </title>
<link rel="stylesheet" type="text/css" media="screen" href="stylo.css" />
<link rel="shortcut icon" href="images/favicon.ico" />
</head>
<body>
<div id="container">
<figure id="logo">
<img src="images/logo22.png" alt="Foodstant Delivery logo" width="" height="" />
</figure>
<figure id="abtex">
<img src="images/abtex222.png" />
</figure>
<div id="navbar">
<ul>
<li class="OP"><img src="images/order.png" />Orders</li>
<li class="MP"><img src="images/menupic3.png" />Menu</li>
<li class="CUP"><img src="images/contact.png" />Contact</li>
<li class="TCP"><img src="images/Pen.png" />About</li>
<li class="JP"><img src="images/pin.png" />Jobs</li>
</ul>
</div>
</div>
</body>
</html>
CSS code: (relevant)
#navbar {
background: rgb(246,248,249); /* Old browsers */
background: -moz-linear-gradient(top, rgba(246,248,249,1) 0%, rgba(229,235,238,1) 46%, rgba(215,222,227,1) 65%, rgba(245,247,249,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(246,248,249,1)), color-stop(46%,rgba(229,235,238,1)), color-stop(65%,rgba(215,222,227,1)), color-stop(100%,rgba(245,247,249,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f8f9', endColorstr='#f5f7f9',GradientType=0 ); /* IE6-9 */
border-top-left-radius: 10px;
border-bottom-left-radius:10px;
border-top-right-radius: 10px;
border-bottom-right-radius:10px;
position: absolute;
top: 200px;
left: 150px;
width: 1000px;
background-position:center;
font-size: 26px;
font-family: 'Conv_LITHOSPRO-REGULAR';
box-shadow: 3px 5px 10px #888888;
}
#navbar ul {
list-style-position:inside;
padding-top: 10px;
}
#navbar ul li {
display: inline;
padding:0 60px 0px 0px;
margin-bottom: 10px;
list-style-type:disc;
}
#navbar ul li.OP {
padding-left: 40px;
}
a:link {
color: #EF174A;
}
a:visited {
color: #BF4100;
}
a:hover {
color: black;
background-color:#D2D2D2;
border-radius: 10px;
}
a:active {
color: #918FBC;
}
a {
text-decoration:none;
}
#navbar ul li.OP a {
padding-left: 10px;
}
<img src="" align="absmiddle">
That will align the text to middle of the image.
or you could do it with css:
.your_class {
vertical-align:middle;
}
Give the text line-height equal to the height of the bar.
a.yourtext { line-height: 44px }
But take care of the paddings.