Replace a Dropdown Menu with a textbox in a responsive template - html

I would like to replace a Dropodown Menu with a textbox in a search form.
The textbox must have the same size of the replaced Dropdown Menu.
Code of the form:
<form action="#">
<input type="text" class="form-control" placeholder="Type your key word">
<div class="dropdown category-dropdown">
<a data-toggle="dropdown" href="#"><span class="change-text">Job Location</span> <i class="fa fa-angle-down"></i></a>
<ul class="dropdown-menu category-change">
<li>Location 1</li>
<li>Location 2</li>
<li>Location 3</li>
</ul>
</div><!-- category-change -->
<button type="submit" class="btn btn-primary" value="Search">Search</button>
</form>
Style:
.category-dropdown {
background-color: #fff;
border-right: 1px solid #e6e6e6;
border-radius: 5px 0px 0px 5px;
min-width: 200px;
line-height: 45px;
text-align: left;
padding: 0 20px;
}
Anyway, here there is the link of the template:
https://demo.themeregion.com/jobs-updated/
Maybe it's a trivial question, but I'm new with the css technical since I'm a backend developer.

A simple way would be something like this, in place of <div class="dropdown category-dropdown">:
<input type="text" class="form-control category-textbox" placeholder="Type your key word">
Style:
.category-textbox{
width: 20%;
min-width: 20%;
}

Related

How to make a Dropdown List shown on top of every parent with position: relative

I'm trying to achieve something like shown below.
The container holds a group of dropdown list that will activate dropdown menu when clicked and the dropdown menu are to be on top of every parent.
Faced problem:
The issue I'm now experiencing is that the dropdown menu hides inside the container rather than appearing on top of the parent level.
What I've tried:
I tried position:absolute, and it works well for putting the list on top of each parent.
Dropdown lists in overflow, on the other hand, will keep their position on their set location rather than following their dropdown label.
Thus, the need for position:relative.
Could somebody provide some light on this?
Your help is much appreciated.
http://jsfiddle.net/6r94bpof/
html,body{
margin: 0;
padding: 0;
overflow: hidden;
}
.land{
display: grid;
grid-template-rows: 1fr 8fr;
height: 100vh;
}
.mainmenu{
border: solid 2px grey;
width: 100%;
height: 80px;
display: flex;
overflow: hidden;
position: relative;
}
.left{
width: 50%;
max-width: 50%;
}
.left-selection{
display: flex;
overflow-y: hidden;
overflow-x: scroll;
}
.right{
width: 50%;
max-width: 50%;
}
.right-selection{
display: flex;
overflow-y: hidden;
overflow-x: scroll;
}
.ddgroup{
display: flex;
}
.ddlist{
position: relative;
display: none;
list-style-type: none;
}
input[type=checkbox]:checked ~ .ddlist{
display: block;
position: relative;
}
<html>
<body>
<div class="land">
<div class="mainmenu">
<div class="left">
<div class="left-selection">
<div class="ddgroup">
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
<ul class="ddmenu">
<input type="checkbox" id="ctrl"/>
<label class="btn" for="ctrl">Click me!</label>
<ul class="ddlist">
<li>Sub-1</li>
<li>Sub-2</li>
<li>Sub-3</li>
</ul>
</ul>
</div>
</div>
</div>
<div class="right">
<div class="right-selection">
<h1>Test<h1/>
<h1>Test<h1/>
</div>
</div>
</div>
</div>
</body>
</html>
I couldn't copy your html and css so I created my own and did it, if it doesn't matches your query plz tell me I will adjust
 *{
margin: 0;
padding: 0;
box-sizing: border-box;
}
input{
display:none;
}
ul, li{
list-style: none;
}
ul{
display: flex;
justify-content: space-around;
gap:1rem;
padding: 1rem ;
}
li{
position: relative;
}
.dropdown-content {
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
margin-top: 10px;
display: none;
}
.dropdown-content > *{
display: block;
text-align: center;
text-decoration: none;
color: #38dce5;
margin-top: 0.3rem;
padding: 0.3rem;
}
input:checked ~ .dropdown-content {
display: block;
}
 
<ul>
<li>
<input type="checkbox" name="" id="input1">
<label for="input1">Click me</label>
<div class="dropdown-content">
Sub 1
Sub 2
Sub 3
</div>
</li>
<li>
<input type="checkbox" name="" id="input2">
<label for="input2">Click me</label>
<div class="dropdown-content" id="pk">
Sub 1
Sub 2
Sub 3
</div>
</li>
<li>
<input type="checkbox" name="" id="input3">
<label for="input3">Click me</label>
<div class="dropdown-content">
Sub 1
Sub 2
Sub 3
</div>
</li>
</ul>

Input field unable to display text in w3.css

I'm trying to create a nav with search functionality. When I input text input field, nothing is displayed. Also how do I deactivate the hover effect? ...using w3.css framework. Thanksview image here
<div class="w3-top">
<ul class="w3-navbar w3-cyan text-color-black w3-large" style="height: 49px; color: black">
<li>Hello</li>
<li class="w3-right" style="font-size: 90%">Log Out</li>
<li class="w3-right" style="font-size: 90%">Dashboard </li>
<li class="w3-right" style="font-size: 90%">Bookmarks</li>
<input class="w3-input w3-border w3-small" style="width: 350px; height: 30px; margin-left: 400px; margin-top: 10px" name="first" type="text" placeholder="search names here">
<button class="w3-btn w3-small w3-white w3-border w3-round" style="margin-left: 615px; margin-top: -30px; height: 30px">Search</button>
<!--<" style="width:450px; height:28px; margin-left: 390px; margin-top: 20px; font-size: 70%" name="first" type="text">-->
</div>
</ul>
</div>
I can't figure out why there is an ending </div> tag before </ul> remove it.
<div class="w3-top">
<ul class="w3-navbar w3-cyan text-color-black w3-large" style="height: 49px; color: black">
<li>Hello</li>
<li class="w3-right" style="font-size: 90%">Log Out</li>
<li class="w3-right" style="font-size: 90%">Dashboard </li>
<li class="w3-right" style="font-size: 90%">Bookmarks</li>
<input class="w3-input w3-border w3-small" style="width: 350px; height: 30px; margin-left: 400px; margin-top: 10px" name="first" type="text" placeholder="search names here">
<button class="w3-btn w3-small w3-white w3-border w3-round" style="margin-left: 615px; margin-top: -30px; height: 30px">Search</button>
<!--<" style="width:450px; height:28px; margin-left: 390px; margin-top: 20px; font-size: 70%" name="first" type="text">-->
</div> <!--please remove this line -->
</ul>
</div>
<div class="w3-top">
<ul class="w3-navbar w3-cyan text-color-black w3-large" style="height: 49px; color: black">
<li>Hello</li>
<li class="w3-right" style="font-size: 90%">Log Out</li>
<li class="w3-right" style="font-size: 90%">Dashboard </li>
<li class="w3-right" style="font-size: 90%">Bookmarks</li>
<input class="w3-input w3-border w3-small" style="width: 350px; height: 30px; margin-left: 400px; margin-top: 10px" name="first" type="text" placeholder="search names here">
<button class="w3-btn w3-small w3-white w3-border w3-round">Search</button>
<!--<" style="width:450px; height:28px; margin-left: 390px; margin-top: 20px; font-size: 70%" name="first" type="text">-->
</div> <!--please remove this line -->
</ul>
</div>
This is because button layer is over input type layer. so you can't see anything typing. you need to remove all inline CSS for the button.
Hello
Log Out
Dashboard
Bookmarks
Search
-->
Please check this now. it's working in snippet

How to center social buttons in bootstrap login page?

I am using django-allauth, bootstrap, font awesome and bootstrap-social for the social media login buttons in my login form. I can't figure out how to center the social buttons within my login-well below. It appears to be aligning to the right of the login well instead of centered. What should I be doing?
jsfiddle
html:
<div class="container">
<div class="row row-centered">
<div class="col-md-4 col-centered">
<div class="well login-well">
<div class="socialaccount_ballot col-md-11">
<ul class="socialaccount_providers">
<li>
<a title="Google" class="btn btn-block btn-social btn-md socialaccount_provider btn-google" href="/accounts/google/login/?process=+login+">
<i class="fa fa-google"></i>Log in with Google
</a>
</li>
<li>
<a title="Facebook" class="btn btn-block btn-social btn-md socialaccount_provider btn-facebook" href="/accounts/facebook/login/?process=+login+">
<i class="fa fa-facebook"></i>Log in with Facebook
</a>
</li>
<li>
<a title="Twitter" class="btn btn-block btn-social btn-md socialaccount_provider btn-twitter" href="/accounts/twitter/login/?process=+login+">
<i class="fa fa-twitter"></i>Log in with Twitter
</a>
</li>
</ul>
</div>
<div class="col-md-12">
<hr>
<form class="login" method="POST" action="/login/">
<div class="form-group"><label class="control-label" for="id_login">Username</label><input autofocus="autofocus" class="form-control" id="id_login" maxlength="30" name="login" placeholder="Username" required="required" title="" type="text" /></div>
<div class="form-group"><label class="control-label" for="id_password">Password</label><input class="form-control" id="id_password" name="password" placeholder="Password" required="required" title="" type="password" /></div>
<div class="form-group"><div class="checkbox"><label for="id_remember"><input class="" id="id_remember" name="remember" type="checkbox" /> Remember Me</label></div></div>
<div class="form-group pull-center">
<button class="btn btn-primary btn-block" type="submit">Sign In</button>
</div>
</form>
<hr>
</div>
<div class="form-group">
<small><a class="text-muted" href="/password_reset/">Forgot Password?</a></small>
<br>
<small><a class="text-muted" href="/signup/">Sign up</a></small>
</div>
</div>
</div>
</div>
</div>
css:
.row-centered {
text-align:center;
}
.col-centered {
display:inline-block;
float:none;
/* reset the text-align */
text-align:left;
/* inline-block space fix */
margin-right:-4px;
}
.socialaccount_providers li a.socialaccount_provider {
rem-border: 1px solid #ddd;
border-radius: 2px;
rem-box-shadow: 2px 2px 8px rgba(0,0,0,.7);
-padding: 10px;
margin-bottom: 6px;
display: block;
width: 100%;
overflow: hidden;
rem-font-size: 1.2em;
}
.socialaccount_providers li a.socialaccount_provider:hover {
text-decoration: none;
box-shadow: 1px 1px 2px rgba(0,0,0,.7);
}
.socialaccount_providers li a.socialaccount_provider.facebook {
background: #4B67A3;
color: #fff;
}
.socialaccount_providers li a.socialaccount_provider.facebook:before {
font-family: FontAwesome;
font-size: 1.9em;
content: "\f082";
display: inline-block;
padding-left: 8px;
padding-right: 8px;
}
What I want it to look like when social buttons are centered:
The ul.socialaccount_providers has a inexplicit padding-left = 40px;
Just throwing in .socialaccount_providers {padding-left:0;} fixes it.

How to increase width of search bar in header

I have to increase the width of search bar and make the border invisible while keeping it mobile responsive. Something like:
http://oneclass.com/#!/notes
HTML
<a class="navbar-brand page-scroll" href="#page-top">dss</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control ipt" placeholder="Search" name="q">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</li>
<li>
Study Material
</li>
<li>
About us
</li>
<li>
Blog
</li>
</ul>
</div>
</div>
You can do it with CSS ...
Just add some style to the class element you want to edit...
I guess you can use something like this:
.ipt {
width: 100%;
position: absolute;
top: 0;
left: 0;
border: 0px;
border-bottom: 1px solid #ccc;
height: 50px;
font-size: 25px;
line-height: 45px;
}
DEMO
you can add some CSS to the input "text" tag.(which with a ipt class here).
.ipt {
border:none; //make the border invisible
width:75%; //set width to % instead of pixel to make it responsible.
height:50px;
font-size:22px; //control the text area's height of the text-input tag.
}
you may check a simple demo here. http://codepen.io/fukurouzhong/pen/JKdLVd

Horizontal and Vertical alignment of a toolbar with Bootstrap elements

I am trying to create a page header / tool bar. This in an existing theme and there is a DIV at the top where this will reside. The basic premise is on the left a H2 title then on the right a bunch of bootstrap elements (search form, bottons, dropdowns etc.
I have tried all kinds of block, inline-block vertical-align etc. I can get the H2 to pull left and the toolbar to pull right but the toolbar elements all pull up to the top of the container div. I just want a clean looking layout with all the elements aligned along their horizontal axis.
I think the pull-right may be part of the problem. That seems to pull the right div up to the top.
Here is a Bootply link: http://www.bootply.com/BPucyP8mpk
<div class"container">
<div id="left">
<h2 class="">Title</h2>
</div>
<div id="right">
<form class="form form-horizontal">
<input type="text" placeholder="search field" class="form-control">
<button type="submit" class="btn">search</button>
</form>
<button class="btn btn-default">Button</button>
<div class="btn-group">
<button class="btn">Left</button>
<button class="btn">Middle</button>
<button class="btn">Right</button>
</div>
<div class="btn-group"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Choice1
</li>
<li>Choice2
</li>
<li>Choice3
</li>
<li class="divider"></li>
<li>Choice..
</li>
</ul>
</div>
</div>
</div>
UPDATE:
Here is the computed CSS that wraps the header I am trying to format:
border-bottom-width: 1px;
border-top-color: rgb(103, 106, 108);
border-top-style: none;
border-top-width: 0px;
box-sizing: border-box;
color: rgb(103, 106, 108);
display: block;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 13px;
height: 70px;
line-height: 18px;
margin-left: -15px;
margin-right: -15px;
padding-bottom: 12px;
padding-left: 20px;
padding-right: 20px;
padding-top: 0px;
width: 1318px;
This is from my custom theme I have installed. This is the computed CSS from this wrapper div:
<div class="row wrapper border-bottom white-bg page-heading">
</div>
UPD:
The most suitable method for this task is use Flexbox
Check it out: http://www.bootply.com/CtVmUbzrlr
<div class="row">
<div id="left" class="col-sm-3 col-md-5">
<h2 class="">Title</h2>
</div>
<div id="right" class="col-sm-9 col-md-7">
<form class="form form-horizontal">
<div class="input-group">
<input type="text" placeholder="search field" class="form-control">
<span type="submit" class="input-group-addon">search</span>
</div>
</form>
<button class="btn btn-default">Button</button>
<div class="btn-group">
<button class="btn">Left</button>
<button class="btn">Middle</button>
<button class="btn">Right</button>
</div>
<div class="btn-group"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Choice1
</li>
<li>Choice2
</li>
<li>Choice3
</li>
<li class="divider"></li>
<li>Choice..
</li>
</ul>
</div>
</div>
</div>
.row{
border: 1px solid #000;
}
#right{
display: flex;
align-items: center;
height: 66px;
justify-content: flex-end;
}
.input-group{
width: 200px;
}
Check this out:
<div class="col-lg-4">
<h2 class="">Title</h2>
</div>
<div class="col-lg-8">
<div class="row">
<form class="form form-horizontal">
<div class="col-lg-8">
<input type="text" placeholder="search field" class="form-control">
</div>
<div class="col-lg-4">
<button type="submit" class="btn btn-block">search</button>
</div>
</form>
</div>
<div class="row">
<div class="col-lg-12">
<button class="btn btn-default">Button</button>
<div class="btn-group">
<button class="btn">Left</button>
<button class="btn">Middle</button>
<button class="btn">Right</button>
</div>
<div class="btn-group"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Choice1
</li>
<li>Choice2
</li>
<li>Choice3
</li>
<li class="divider"></li>
<li>Choice..
</li>
</ul>
</div>
</div>
</div>
</div>
you can check bootply also : http://www.bootply.com/LmGjZM6fHH
You need to manage your layout with the col-md-*
This is just for the demo, you can arrange with you own way
What about utilizing the navbar component from bootstrap?
http://getbootstrap.com/components/#navbar
I think the example here pretty much sums up your needs.
Basically I've added classes navbar-btn to the buttons, and navbar-form to the form to get them to align properly. I added the class navbar-right to both the form and the group of buttons.
http://www.bootply.com/IySnkX2ioK
Edit: The navbar-default class was just added to outline the bounds of the navbar, not part of the solution.
First thing is that if you want to have your search box on left - place it first and then button group with dropdown. Second, don't place navbar-rigth inside another navbar-rigth. And the last thing - just wrap your right-side elements in one div and add to it a little padding
Updated link