CSS Move Icon to Right of Input Field - html

How do I move the magnifying glass to the right hand side in my input field?
Here's my Fiddle.
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
body {
margin: 30px;
}
.search {
position: relative;
color: #aaa;
font-size: 16px;
}
.search input {
width: 250px;
height: 32px;
background: #fcfcfc;
border: 1px solid #aaa;
border-radius: 5px;
box-shadow: 0 0 3px #ccc, 0 10px 15px #ebebeb inset;
}
.search input {
text-indent: 32px;
}
.search .fa-search {
position: absolute;
top: 10px;
left: 10px;
}
<div class="search">
<span class="fa fa-search"></span>
<input placeholder="Search term">
</div>

You set left: 10px to an icon too. Set there more pixels from left side, or directly pixels from right.
.search .fa-search {left: 230px;}
http://jsfiddle.net/xhjLyf1k/1/
Setting right position instead of the left one (to prevent resizing of input field):
.search {display: inline-block} /* prevent 100% width */
.search .fa-search {left: auto; right: 10px;}
http://jsfiddle.net/xhjLyf1k/2/

you can also use a ::before pseudo-element within in the css itself to add a icon at right
.search::before {
position: absolute;
height: 3rem;
width: 3rem;
top: 50%;
transform: translate(-50%, -50%);
right: 0rem;
content: "";
background-image: url('../images/search.png');
background-size: contain;
}

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" rel="stylesheet"/>
<div class='form-group'>
<label>Clave</label>
<div class="input-group input-group-sm" >
<input class='form-control' type="password">
<div class="input-group-btn">
<button type="submit" id="togglePassword" class="btn btn-default fa fa-eye"></button>
</div>
</div>
</div>
Bootstrap y Font Awesome
https://jsfiddle.net/jlujan/kgxo81fm/15/

Create a relative container span around the icon and input so the icon is always positioned relative to the input, rather than the div which is 100% width. Then you can move this component anywhere and have the icon work.
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
body {
margin: 30px;
}
.search {
color: #aaa;
font-size: 16px;
}
.form-element {
position: relative;
}
.search input {
width: 250px;
height: 32px;
background: #fcfcfc;
border: 1px solid #aaa;
border-radius: 5px;
box-shadow: 0 0 3px #ccc, 0 10px 15px #ebebeb inset;
}
.search input {
text-indent: 1em;
}
.search .fa-search {
position: absolute;
top: 0;
right: 10px;
bottom: 0;
}
<div class="search">
<span class="form-element">
<span class="fa fa-search"></span>
<input placeholder="Search term">
</span>
</div>

Related

Place button inside input

I need to place a button, with an icon, an input so I tried the HTML:
(JSFiddle Example: https://jsfiddle.net/mdmoura/zup3b24e/12/):
<form>
<div class="wrapper">
<input type="text">
<button type="submit">
<i class="fa fa-search"></i>
</button>
</div>
</form>
With the following CSS:
form {
width: 400px;
}
.wrapper {
position: relative;
}
input {
font-size: 18px;
padding: 10px;
width: 100%;
}
button {
background-color: white;
border: none;
font-size: 24px;
position: absolute;
right: 0;
}
But this does not place the button inside the input.
How can this be done?
All you need to do is to add bottom: 8px; to the button so it is moved up by 8px, visually into the input box.
button {
background-color: white;
border: none;
font-size: 24px;
position: absolute;
right: 0;
bottom: 8px;
}
form {
width: 400px;
}
.wrapper {
position: relative;
}
input {
font-size: 18px;
padding: 10px;
width: 100%;
}
button {
background-color: white;
border: none;
font-size: 24px;
position: absolute;
right: 0;
bottom: 8px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<form>
<div class="wrapper">
<input type="text">
<button type="submit">
<i class="fa fa-search"></i>
</button>
</div>
</form>
Updated JSFiddle: https://jsfiddle.net/zup3b24e/14/
A simpler way to build an input form with font awesome inside if you want to go with this direction
input[type="text"] {
width: 400px;
height: 20px;
padding: 10px;
}
input[type="submit"] {
font-family: FontAwesome;
font-size: 24px;
margin-left: -50px;
background-color: white;
border: none;
-webkit-appearance: none;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<input type="text"><input type="submit" value="">

Position search bar and button on an background image with bootstrap and CSS

I am trying to position the search bar on a background image. I am also trying to position a button at the bottom and center of the image. Following that, I will have containers.
What I am trying to achieve.
But what I am stuck and confused with positioning. The glyphicon is not working as well?
My Code
<style>
.card {
border: 0px solid;
}
.drop-shadow {
-webkit-box-shadow: 0 0 2px 2px rgba(0, 0, 0, .5);
box-shadow: 0 0 10px 1px rgb(211, 211, 211, 0.8);
border-radius: 0px;
}
.container-fluid {
width: auto
}
.container-fluid.drop-shadow {
margin-top: 2%;
margin-left: 5%;
margin-right: 5%
}
.img-fluid {
height: 200px;
}
#child {
width: 100%;
height: 20px;
margin: auto;
text-align: center;
bottom: 0px;
position: absolute;
}
.btn-checkin {
display: inline-block;
text-align: center;
white-space: nowrap;
color: #fff;
border-color: #EC008c;
text-transform: uppercase;
background-color: #EC008c;
font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
padding: 0.375rem .75rem;
font-size: 13px;
border-radius: .25rem;
}
</style>
</head>
<body id="page-top">
<div class="card">
<img class="img-fluid" src="img/1847p.png" alt="Card image cap">
<div class="col-md-5">
<div class="form-group">
<div class="icon-addon addon-lg">
<input type="text" placeholder="Search Class" class="form-control" style="height:30px;position:absolute" id="email">
<label for="email" class="glyphicon glyphicon-search" rel="tooltip" title="email"></label>
</div>
</div>
</div>
<div id="child">
<button class="btn-checkin">Check in</button>
<div class="container-fluid drop-shadow">
<div class="row">
frsjafksdalkdfsa
</div>
fsdfdasasd
</div>
</div>
</div>
Problems to target :
Get the search bar on the background pic
Set the background pic always on top of the screen with full width but with certain height. I currently hard coded the height to 200px. Is there a way that it can be responsive?
I am also stuck with the glyphycon issue, why is it not displayed?
How do I position the button at the bottom of the image and in the
center?
Use margin-top with negative value to make the form goes on the image.
Glyphicons look to be working great simply here.
* {
box-sizing: border-box;
}
img {
width: 100%;
}
div#form-box {
margin-top: -95px;
text-align: center;
}
div#input-group {
width: 80%;
margin: 0 auto 20px;
position: relative;
background-color: #fff;
border: none;
border-radius: 5px;
}
input#email, label[for="email"] {
display:inline-block;
vertical-align: middle;
}
input#email {
width: calc(100% - 40px);
padding: 10px;
border: none;
}
label[for="email"] {
width: 40px;
line-height: 40px;
}
button#btn-checkin {
display: inline-block;
padding: 6px 10px;
border: none;
border-radius: 5px;
background-color: #EC008c;
color: #fff;
text-align: center;
text-transform: uppercase;
}
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" />
</head>
<img src="http://wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-4.jpg" />
<div id="form-box">
<form>
<div id="input-group">
<label for="email" class="glyphicon glyphicon-search"></label><!--
--><input type="text" placeholder="Search Class" id="email">
</div>
<br/>
<button id="btn-checkin">Check-in</button>
</form>
</div>
<br/>
<br/>
<br/>
.card{
border:0px solid;
position:relative;
height:200px;
background:url('https://preview.ibb.co/fex0wK/1847p.png') no-repeat top center;
background-size:cover;
}
.card img {
width:100%;
}
.search-box {
position : absolute;
display:inline-block;
bottom:-30px;
left:0;
right:0;
padding:15px;
text-align:center;
}
.drop-shadow {
-webkit-box-shadow: 0 0 2px 2px rgba(0, 0, 0, .5);
box-shadow: 0 0 10px 1px rgb(211, 211, 211, 0.8);
border-radius:0px;
}
.container-fluid{
width:auto
}
.container-fluid.drop-shadow {
margin-top:2%;
margin-left:5%;
margin-right:5%
}
.img-fluid {
height: 200px;
}
#child{
width:100%;
height: 20px;
margin: auto;
text-align: center;
margin-top: 40px;
}
.form-group {
width:100%;
margin-bottom:10px;
}
.btn-checkin{
display: inline-block;
text-align: center;
white-space: nowrap;
color: #fff;
border-color: #EC008c;
text-transform: uppercase;
background-color: #EC008c;
font-family:'Open Sans','Helvetica Neue',Arial,sans-serif;
padding: 0.375rem .75rem;
font-size: 13px;
border-radius: .25rem;
}
.icon-addon {
position:relative;
}
.icon-addon label {
position: absolute;
left: 2px;
top: 2px;
padding: 8px;
font-size: 20px;
}
.icon-addon input {
height:40px;
padding-left:35px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<body id="page-top">
<div class="card" >
<!-- <img class="img-fluid" src="img/1847p.png" alt="Card image cap"> -->
<div class="search-box">
<div class="form-group">
<div class="icon-addon addon-lg">
<input type="text" placeholder="Search Class" class="form-control" id="email">
<label for="email" class="glyphicon glyphicon-search" rel="tooltip" title="email"></label>
</div>
</div>
<button class="btn-checkin">Check in</button>
</div>
</div>
<div id="child">
<div class="container-fluid drop-shadow">
<div class="row">
frsjafksdalkdfsa
</div>
fsdfdasasd
</div>
</div>
Try this code...If you need any help, let me know.
Ok so you want to position the search bar inside a image.
Make a div with the image as background
background: image_source;
background-size: contain;
position: relative; //must to write
width: 100%;
height: 100px; //as much as you want
Then the css for search bar
position: absolute;
then use top, left,etc to position the search bar

Radio buttons are checked simultaneously

I've been trying to replicate this page https://vk.com/ You can see that they've changed the standard appearance of radio buttons in the 2nd form.
I succeeded in changing the design of the buttons but now they are all checked simultaneously.
HTML
<form class="form2">
<div class="heading">
<h2>Poprvé na VK?</h2>
<p>Okamžitá registrace</p>
</div>
<input type="text" placeholder="Vaše jméno" required>
<input type="text" placeholder="Vaše příjmení" required class="last-name">
<label class="birth">
<span>Datum narození
<i class="fa fa-question-circle-o"
aria-hidden="true"></i></span>
<input type="date" class="date" required>
</label>
<label>
<span class="gender-head">Pohlaví</span>
<div class="gender">
<input type="radio" id="1-option" name="selector" value="female" class="control">
<div class="button"></div>Žena
<input type="radio" id="2-option" name="selector" value="male" class="control">
<div class="button"></div>Muž
<input type="radio" id="3-option" value="other" name="selector" class="control">
<div class="button"></div>Jiné
</div>
</label>
<button type="submit">Zaregistrovat se</button>
<a href="#">
<i class="fa fa-facebook-square" aria-hidden="true"></i> Přihlásit se přes Facebook</a>
</form>
CSS
form {
width: 290px;
background-color: #fff;
padding: 20px 15px;
float: right;
border: 1px solid #E0E1E3;
font-size: 13px;
border-radius: 3px;
}
.form2 {
margin-right: 10px;
clear: right;
height: 380px;
display: flex;
flex-flow: row wrap;
color: #333436;
justify-content: center;
}
.form2 .heading {
flex-wrap: wrap;
margin: 0 auto;
}
.form2 h2 {
margin-top: 0px;
margin-bottom: 0px;
font-size: 20px;
font-weight: 100;
}
.form2 p {
font-size: 12px;
margin: 2px 0 0 9px;
}
.form2 input {
height: 30px;
border-radius: 3px;
border: 1px solid #DBDCDE;
width: 270px;
margin-top: -15px;
margin-bottom: 0;
}
.form2 .last-name {
margin-top: -15px;
}
.form2 span {
font-weight: 600;
margin-top: -50px;
color: #7A7B7D;
font-size: 13px;
}
.form2 .birth {
margin: -15px 0 0 10px;
}
.form2 .date {
margin-top: 10px;
margin-bottom: -100px;
}
.form2 .gender-head {
margin-left: -10px;
margin-bottom: 20px;
}
.gender {
display: flex;
width: 260px;
margin: 15px 0 0px -10px;
justify-content: space-between;
font-size: 13px;
color: #000;
}
.gender input[type="radio"] {
position: absolute;
top: -9999px;
left: -9999px;
}
.gender .button {
border: 1px solid #A3A4A6;
background: #fff;
border-radius: 50%;
height: 12px;
width: 12px;
margin-top: 2px;
margin-right: -40px;
}
.gender .button:hover {
cursor: pointer;
background-color: #EAEBED;
}
.gender .button::before {
display: block;
content: '';
height: 6px;
width: 6px;
border-radius: 50%;
}
input[type="radio"]:checked ~ .button {
border: 1px solid #5A7CA3;
}
input[type="radio"]:checked ~ .button::before {
background: #5A7CA3;
margin: 3px 2px 2px 3px;
}
::-webkit-input-placeholder {
color: #7A7B7D;
padding-left: 12px;
}
.form2 button {
height: 20px;
}
http://jsfiddle.net/Skidle/u3zj66sd/
I haven't learned JavaScript yet so I'd prefer CSS & HTML only solution. Thanks!
If you look at the radio buttons, by removing the position, you can see that only one is selected, and it is correct for each selection:
The problem lies in the way the presentation works. The CSS code:
input[type="radio"]:checked ~ .button::before // Is wrong.
input[type="radio"]:checked + .button::before // Is right.
Explanation
The code given for the CSS, ~ selector is a sibling selector, which selects all the selectors.
While, what you need is the + selector, which is the immediate or adjacent sibling selector. This selects only one.
Change needs to be done here:
input[type="radio"]:checked + .button::before {
background: #5A7CA3;
margin: 3px 2px 2px 3px;
}
Fiddle: http://jsfiddle.net/0rqu3s2c/
Note: There's an issue when you try to click on the other inputs. So, you might need to check what's blocking it. Please do not use absolute positioning without the desired result.

Different layouts on firefox and chrome

I'm developing a site where the header has cart button and search bar.
fiddle
My question is in chrome and firefox you will see different spaces between cart button and search input. Chrome version should be the right layout. Any suggestions? Help is appreciated.
body {
background: #000000;
}
img[alt="cart-icon"] {
width: 20px;
}
img[alt="telephone-icon"] {
/*width: 18px;*/
margin-top: -4px;
margin-right: 3px;
}
.right {
float: right;
text-align: right;
margin-top: 21px;
}
.tel-no {
color: #fff;
margin-top: -7px;
margin-right: 19px;
font-weight: normal;
text-align: right;
font-size: 15px;
font-family: avenirreg;
}
.tel-no p {
margin-bottom: 0;
display: inline;
}
.cart1 {
float: right;
margin-top: 9px;
margin-right: 7px;
}
.top-cart .truncated {
display: none;
}
.header-search-form {
float: right;
}
.right input[type='text'] {
background-color: rgba(0, 0, 0, 0);
border: 1px solid #7B7672;
border-radius: 0;
width: 125px;
height: 21px;
padding-left: 5px;
margin-right: -19px;
color: #ccc !important;
}
.right input[type='text']:focus {
outline: none;
background-color: #444;
}
.right button[type='submit'] {
position: relative;
border: none;
/* background-size: 19px; */
background-size: 15px;
height: 25px;
width: 25px;
background: rgba(0, 0, 0, 0) url('../images/ico-search.png') no-repeat center center;
left: -11px;
top: 6px;
}
/* firefox*/
#-moz-document url-prefix() {
.header-row-1 button[type='submit'] {
position: relative;
border: none;
/* background-size: 19px; */
background-size: 15px;
height: 24px;
width: 25px;
background: rgba(0, 0, 0, 0) url('../images/ico-search.png') no-repeat center center;
left: 0px;
top: -25px;
}
}
.header-row-1 button[type='submit']:hover {
background-color: #ED1B24 !important;
}
.cart-label {
background-color: red;
color: #fff;
/* border-radius: 11px; */
padding: 2px 4px;
font-size: 9px;
position: relative;
top: -9px;
left: -11px;
}
<div class="right">
<div class="tel-no">
<img src="http://www.encorediamond.co.uk/skin/frontend/ecd/default/images/common/telephone-icon.fw.png" alt="telephone-icon">
<p><span>015395 67957</span>
</p>
</div>
<div class="cart1">
<a href="#header-cart" class="toggle-minicart skip-link skip-cart">
<!--<img src="" alt="cart-icon">
<span class="cart-label">5</span>-->
<img src="http://www.encorediamond.co.uk/skin/frontend/ecd/default/images/common/cart-icon.fw.png" alt="cart-icon">
<span class="cart-label">
0 </span>
</a>
</div>
<div class="col-lg-4 col-md-5 col-sm-5 col-xs-12 top-cart" style="display: none">
<div class="header-minicart">
<a href="#header-cart" class="skip-link skip-cart no-count">
<!--<span class="icon"></span>
<span class="label"> ( </span>
<span class="count"> )</span>-->
</a>
<div id="header-cart" class="block block-cart skip-content">
<div id="minicart-error-message" class="minicart-message"></div>
<div id="minicart-success-message" class="minicart-message"></div>
<div class="minicart-wrapper">
<p class="block-subtitle">Recently added item(s) <a class="close skip-link-close" href="#" title="Close">×</a>
</p>
<p class="empty">You have no items in your shopping cart.</p>
</div>
</div>
</div>
</div>
<form id="search_mini_form" action="http://www.encorediamond.co.uk/catalogsearch/result/" method="get">
<div class="header-search-form">
<input kl_virtual_keyboard_secure_input="on" autocomplete="off" id="search" name="q" value="" class="input-text" maxlength="128" type="text">
<button type="submit" title="Search" class="button"></button>
<div style="display: none;" id="search_autocomplete" class="search-autocomplete"></div>
<script type="text/javascript">
//<![CDATA[
var searchForm = new Varien.searchForm('search_mini_form', 'search', '');
searchForm.initAutocomplete('http://www.encorediamond.co.uk/catalogsearch/ajax/suggest/', 'search_autocomplete');
//]]>
</script>
</div>
</form>
<!-- <div class="navbar-toggle collapsed mobile-expand" data-toggle="collapse" data-target=".navbar-collapse"></div>--></div>
please include following in your CSS this style will apply only for firefox you can give margin bottom only for firefox
#-moz-document url-prefix() {
.cart1 {
margin-bottom: 5px;
}
you should use (Edited)
#search_mini_form {
float: right;
margin-top: 9px;/*Same as .cart1*/
}
instead of
.header-search-form {
float: right;
}
And replace position:relative with float:right; for .right button[type='submit']:
.right button[type='submit'] {
float:right;
border: none;
/* background-size: 19px; */
background-size: 15px;
height: 25px;
width: 25px;
background: rgba(0, 0, 0, 0) url('../images/ico-search.png') no-repeat center center;
left: -11px;
top: 6px;
}
#search_mini_form is the element containing your input, and it is the sibling element of your .cart1 element. So, if you want to set your layout using float, elements you want to position have to be siblings. That's why I set the floatproperty to the parent element of your input that is a sibling of .cart1
Exemple

how to reduce div size in CSS?

I am trying to design a login page, the screenshot is below.
http://prntscr.com/2pksiq
Where as i want the output as http://prntscr.com/2pga73 . I am trying to reduce the size of the tags
<div id="logo" class="logo col-xs-2"></div>
<div id="title" class="page-title green-bg col-xs-8">Local Adventures</div>
I am new to CSS, please suggest me a way to fix this. I am using twitter bootstrap in my project.
I have the below HTML:
<div class="visible-xs stop-detail">
<head>
<link href="C:/L.A project/local-adventure/web/src/main/webapp/resources/components/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="C:/L.A project/local-adventure/web/src/main/webapp/resources/components/bootstrap/js/bootstrap.min.js"></script>
<link href="C:/L.A project/local-adventure/web/src/main/webapp/resources/localadventures/css/createaccount.css" rel="stylesheet">
<link href="C:/L.A project/local-adventure/web/src/main/webapp/resources/localadventures/css/styles.css"rel='stylesheet' type='text/css' href='styles.css' />
<link href="C:/L.A project/local-adventure/web/src/main/webapp/resources/localadventures/css/main.css" rel="stylesheet">
</head>
<meta charset="utf-8">
<title>Local-Adventures</title>
<div id="login-form">
<div class="logo col-xs-4"></div>
<div class="page-title green-bg col-xs-8">Local Adventures</div>
Create an Account
Sign In
<input type="email" required value="Email Address" onBlur="if(this.value=='')this.value='Email Address'" onFocus="if(this.value=='Email Address')this.value='' ">
<input type="email" required value="Password" onBlur="if(this.value=='')this.value='Password'" onFocus="if(this.value=='Password')this.value='' ">
<input type="email" required value="Confirm password" onBlur="if(this.value=='')this.value='Confirm password'" onFocus="if(this.value=='Confirm password')this.value='' ">
<br><br>
<span class='btn btn-lg btn-success btn-block'>Create An Account</span>
<span class='btn btn-lg btn-primary btn-block'>Facebook Login</span>
</div> <!-- end login-form -->
</div>
My CSS is below:
#charset "utf-8";
/* CSS Document */
/* ---------- GENERAL ---------- */
/*
body {
background: #FFFFFF;
color: #999;
font: 100%/1.5em sans-serif;
margin: 0;
}
*/
a {
color: #2a2a2a;
text-decoration: none;
margin:1px 33;
}
a:hover { color: #88c425; }
fieldset {
border: none;
margin: 0;
}
.btn-success {
border-radius:0px;
background-color: #88c425
}
.btn-success:hover {
background-color: #88c425
}
.btn-primary {
border-radius:0px;
}
input {
border: none;
font-family: inherit;
font-size: inherit;
margin: 0;
-webkit-appearance: none;
}
input:focus {
outline: none;
}
input[type="submit"] { cursor: pointer; }
.clearfix { *zoom: 1; }
.clearfix:before, .clearfix:after {
content: "";
display: table;
}
.clearfix:after { clear: both; }
/* ---------- LOGIN-FORM ---------- */
#login-form {
margin: 50px auto;
width: 300px;
}
#login-form h3 {
background-color: #79a002;
border-radius: 5px 5px 0 0;
color: #fff;
font-size: 14px;
padding: 20px;
text-align: center;
text-transform: uppercase;
}
#login-form fieldset {
background: #fff;
border-radius: 0 0 -1px -1px;
padding: 0px;
}
#login-form fieldset:before {
background-color: #fff;
content: "";
height: 8px;
left: 50%;
margin: -4px 0 0 -4px;
position: absolute;
top: 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
width: 8px;
}
#login-form input {
font-size: 14px;
}
#login-form input[type="email"], #login-form input[type="password"] {
border:none; /* clear previous borders */
border-bottom: 1px solid #88c425; /* add bottom border */
padding: 12px 10px;
width: 300px;
}
#login-form input[type="email"] {
border-radius: 3px 3px 0 0;
}
#login-form input[type="password"] {
border-top: none;
border-radius: 0px 0px 3px 3px;
}
#login-form input[type="submit"] {
background: #1dabb8;
border-radius: 3px;
color: #fff;
float: right;
font-weight: bold;
margin-top: 20px;
padding: 12px 20px;
}
If you use Bootstrap, you had configurate before download it your GRID
It seems do be like a 12 Grid.
you used :
<div id="title" class="page-title green-bg col-xs-8">Local Adventures</div>
it should be :
<div id="title" class="page-title green-bg col-xs-4">Local Adventures</div>
you take 8 pieces from a 12 piece cake, so its larger. just take the half and you will get the same width you want for.
And please, if you use a mighty framework like bootstrap, dont overwrite its own classes with ids or something, its bad practise!
Maybe your bootstrap is overriding your css? Try putting important at the end:
#title{
width: 400px !important;
height: 90px !important;
}