Hi I trying to do the following for getting the search button inside the input field with class input-ol, but its not working. I am writing the following code.
<form id="search_form" onsubmit="return false;">
<div class="input-group">
<input type="text" class="input-ol" name="query" placeholder="Ex: cars, watches, exercise... "/>
<span class="input-group-btn" onclick="return searchcontent()">
<button class="btn btn-outline-primary" type="button" aria-label="Search">
<i class="fa fa-search fa-2x" aria-hidden="true"></i>
</button>
</span>
</div>
</form>
The output looks like this
I think you need to add the class form-control to your input element to get it to work.
.input-group input.input-ol {
border-radius: 50px;
}
button.rounded {
border-radius: 10px 50px 50px 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-lg-6">
<form id="search_form" onsubmit="return false;">
<div class="input-group">
<input type="text" class="input-ol form-control" name="query" placeholder="Ex: cars, watches, exercise... " />
<span class="input-group-btn" onclick="return searchcontent()">
<button class="btn btn-outline-primary btn-primary rounded" type="button" aria-label="Search">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</span>
</div>
</form>
</div>
</div>
I also removed the class fa-2x from the icon element just to make the snippet work, but if you have additional styles that make the larger button work with your input field you probably won't have to remove that class.
Related
I would like to remove the space between <input> and <button>.
In the CSS, I tried with padding: input, button {padding : 0px}, but it didn't work.
<form action="search">
<div class="input-search">
<span class="input-icon">
<i class="fas fa-map-marker-alt"></i>
</span>
<input type="text" placeholder="Los Angeles" />
<button type="submit">
<strong>Search</strong>
</button>
</div>
</form>
margin-left: -1em; maybe?
Margin can have negative value...
button{
margin-left: -1em;
}
<form action="search">
<div class="input-search">
<span class="input-icon">
<i class="fas fa-map-marker-alt"></i>
</span>
<input type="text" placeholder="Los Angeles" /> <button type="submit"><strong>Search</strong></button>
</div>
</form>
You can add the input-search div style display:flex.
<form action="search">
<div class="input-search" style="display:flex;">
<span class="input-icon">
<i class="fas fa-map-marker-alt"></i>
</span>
<input type="text" placeholder="Los Angeles" /> <button type="submit"><strong>Search</strong></button>
</div>
</form>
Hi there can someone please help me how can I change on focus from search icon to x icon this is my code:
<form class="navbar-form navbar-left" role="search" style="padding-top: 42px;padding-left: 75px;">
<div class="input-group">
<div class="form-group">
<input style=" background: #f2f2f2;" type="text" class="form-control search" placeholder="search" name="search" id="navbar-search-input">
</div>
<div class="input-group-btn">
<button type="button" id="btnSearch" style=" " class="btn btn-success btnSearch"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
The trick is use + to select the next sibling, please check the example
.navbar-form input:focus + .input-group-btn > .btn > i:before{
content: "\f00d";
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<form class="navbar-form navbar-left" role="search" style="padding-top: 42px;padding-left: 75px;">
<div class="input-group">
<input style=" background: #f2f2f2;" type="text" class="form-control search" placeholder="search" name="search" id="navbar-search-input">
<div class="input-group-btn">
<button type="button" id="btnSearch" style=" " class="btn btn-success btnSearch">
<i class="fa fa-search">
</i>
</button>
</div>
</div>
</form>
I simply want to display a "Choose file" input right from my input field, but I couldn't make it work.
What I have now is :
<div class="col-md-12">
<div class="d-inline-block">
<input type="text" class="form-control" id="bookTitle" aria-describedby="" placeholder="Enter Author">
</div>
<div class="d-inline-block">
<label class="btn btn-default">
<i class="fa fa-upload" aria-hidden="true"></i> Choose a file... <input type="file" name="text_file" hidden>
</label>
</div>
{{--<input type="file" class="btn" name="text_file" />--}}
</div>
This gives me the following result :
The input should be three times bigger than this.
Then I tried this approach :
<div class="d-inline-block col-md-10">
<label for="exampleInputEmail1">Title</label>
<input type="text" class="inline-block form-control" id="bookTitle" aria-describedby="" placeholder="Enter document title">
</div>
<div class="d-inline-block col-sm-20">
<label class="btn btn-default inline-block">
<i class="fa fa-upload" aria-hidden="true"></i> Choose a file... <input type="file" name="image" hidden>
</label>
</div>
And this have me the following result :
In this case the input is the right size, but the "Choose file" is not where it's supposed to be.
Can someone help me make this work?
p.s the div is in a <div class="row">
Try an input group https://getbootstrap.com/docs/4.0/components/input-group
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-sm-12">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for..." aria-label="Search for...">
<span class="input-group-btn">
<label class="btn btn-default inline-block">
<i class="fa fa-upload" aria-hidden="true"></i> Choose a file... <input type="file" name="image" hidden>
</label>
</span>
</div>
</div>
</div>
I am trying to align the search button right next to the search box however button seems to be below. This is what I got:
<form action="{linkto page="search.php"}" method="get" id="searchFormTest">
<input type="text" id="searchPhrase" name="searchPhrase" class="searchInputBox" value="{$lang.enterKeywords}" placeholder="Suchbegriff oder Bildnummer">
<div style="display: inline;">
<button type="submit" value="Submit">
<i style="font-size: 40px;" class="fa fa-search" aria-hidden="true"></i>
</button>
</div>
</form>
Float your search input to the left, float your submit button to the left. Ready.
input[type="search"],
button {
float: left;
}
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<div style="display: inline;">
<input type="text"/>
<span> <button type="submit" value="Submit">
<i style="font-size: 20px;" class="fa fa-search" aria-hidden="true"></i></span>
</button>
</div>
this should work to have the icon right next to the search box.
You code works just fine in jsfiddle. I think you should look into css styles which are being inherited by the button.
<form method="get" id="searchFormTest">
<input type="text" id="searchPhrase" name="searchPhrase" class="searchInputBox" placeholder="Suchbegriff oder Bildnummer">
<div style="display: inline;">
<button type="submit" value="Submit">
<i style="font-size: 15px;" class="fa fa-search" aria-hidden="true">Search</i>
</button>
</div>
</form>
Hi for all and thank you for your time.
How can I correctly add a "button / submit" next to a group of button or radio
image: Broken borders of buttons
Thank you again for your help.
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="input-group">
<span class="input-group-addon"><i aria-hidden="true" class="fa fa-code-fork"></i></span>
<input name="data[Domain][domain_name]" class="input-sm form-control" placeholder="Nouveau domaine" maxlength="25" id="DomainDomainName" type="text">
<span class="input-group-addon"><small>ajouté à </small></span>
<div class="input-group-btn" data-toggle="buttons">
<label class="btn btn-sm btn-info active">
<input name="data[Domain][type_domain]" id="DomainTypeDomain2" value="2" type="radio"> Location
</label>
<label class="btn btn-sm btn-info">
<input name="data[Domain][type_domain]" id="DomainTypeDomain1" value="1" type="radio"> Service
</label>
</div>
<div class="input-group-btn">
<button class="btn-success btn-sm btn btn-default">
<i aria-hidden="true" class="fa fa-plus-circle"></i>
</button>
</div>
</div>
Just add border-radius: 0px it will work.
Working snippet
#btnrad {
border-radius: 0px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="input-group">
<span class="input-group-addon"><i aria-hidden="true" class="fa fa-code-fork"></i></span>
<input name="data[Domain][domain_name]" class="input-sm form-control" placeholder="Nouveau domaine" maxlength="25" id="DomainDomainName" type="text">
<span class="input-group-addon"><small>ajouté à </small></span>
<div class="input-group-btn" data-toggle="buttons">
<label id="btnrad" class="btn btn-sm btn-info active">
<input name="data[Domain][type_domain]" id="DomainTypeDomain2" value="2" type="radio"> Location
</label>
<label id="btnrad" class="btn btn-sm btn-info">
<input name="data[Domain][type_domain]" id="DomainTypeDomain1" value="1" type="radio"> Service
</label>
</div>
<div class="input-group-btn">
<button class="btn-success btn-sm btn btn-default">
<i aria-hidden="true" class="fa fa-plus-circle"></i>
</button>
</div>
</div>