I wish to add a font awesome icon beside my input button.
So, I found this answer and only option 1 apply to my use case since I need to submit a form to delete repository.
But the input button does not match the color of span tag.
I tried to add btn-danger class into input tag but it has shadow.
https://jsfiddle.net/coolwei/4osuyrk5/6/
What I want to achieve is a consistent color and button size with View and Add button.
First of all, you should use <button> tag.
However, if you really have to do this that way, you should clear default input styles like this:
.clear-input {
background: none;
color: inherit;
padding: 0;
border: 0;
}
And add this class to your input
<input class="clear-input" type="submit" value="Delete">
https://jsfiddle.net/2vdabphn/
I'm not sure why you're nesting a button inside an a here.
<a href="#">
<button type="button" class="btn btn-success mr-1">
<i class="fas fa-user-plus"></i>
Add Student
</button>
</a>
For your submit button, what you want to do is use the button tag with the type="submit" property.
<button type="submit" class="btn btn-danger">
<i class="far fa-trash-alt"></i>
Delete
</button>
Related
I am using bootstrap and CSS to style my website but I can't seem to figure out how to change the font style and weight of the text within my buttons. Here is some of my code
<button type="button-apple" class="btn btn-light btn-lg download-button"><i class="fab fa-google-play"></i> Download</button>
I would like to change the font to be bolder so the words are easier to read because on my screen they come out as very thin lines.
Thanks in advance.
Whenever you try to work into libraries, please keep in mind that, you are overriding the style they already defined. In that case, just defining new styles such as color, font-weight etc. will not work. And also, please don't try to modify the class names they are already using.
You Can solve it in several ways
First Method is to add a new class from your own example: here -> .my-button-class and try to do
the styling. Then use !important with that, it will override the
style you want.
For Example
Your HTML will be as follow:
<button type="button-apple" class="btn btn-light btn-lg download-button my-button-class">
<i class="fab fa-google-play"></i> Download
</button>
CSS for the first method
.my-button-class{
font-weight: bolder !important;
font-size: 2rem !important;
color: blue !important;
};
Second Method using specificity which is calling a class inside of a tag for example: button.my-button-class to style it instead of using !important, that's also a very good solution.
CSS for the second method
button.my-button-class{
font-weight: bolder;
font-size: 2rem;
color: blue;
};
Hope it will solve your problem. :)
Thanks
You can wrap your button text in an anchor and then use a span item:
<a href="#" class="btn btn-light btn-lg download-button">
<i class="fab fa-google-play"></i>
<span style="font-weight:bolder;">Download</span>
</a>
I want to add image button inside an input button which has url.action method
<input type="button" class="btn btn-primary" value="View Chart" onclick="location.href='#Url.Action("Multigraph", "Home")'"/>
Actually i want to do this
On click of the image i will be able to go to the specific view
I have also looked into this link
Any help will be appreciated
You could style the input button with css.
.btn--graph {
width: 110px;
height: 93px;
background-image: url('http://i.stack.imgur.com/jCvdY.jpg');
}
<input type="button" class="btn btn-primary btn--graph" onclick="location.href='#Url.Action("Multigraph", "Home")'"/>
However if this button is actually a link to another webpage. It would semantically be more correct to use an anchor link.
<a href="#Url.Action("Multigraph", "Home")">
<img src="http://i.stack.imgur.com/jCvdY.jpg" alt="View Chart">
</a>
I have a link styled as follows:
<style>
.addNew{
background-color: #FFF;
display: block;
margin-top: 10px;
padding: 20px;
color: #08c;
border:3px dashed #08c;
cursor: pointer;
width: 100%;
box-sizing: border-box;
font-size: 1em;
}
</style>
<a class='addNew'>
<i class="fa fa-plus" ></i> Add new
<span style='text-decoration:underline'>Object</span>
</a>
I am using a span-tag inside the text and a font-awesome icon.
How can I use this for an submit button? I tried this:
<input type='submit' class='addNew' value="Add new Object">
But I have no idea how to style the text of the submit button.
Use a button element.
<button class='addNew'>
<i class="fa fa-plus" ></i> Add new
<span style='text-decoration:underline'>Object</span>
</button>
… then you can have child elements and target them independently for styling.
You can use <button>
<button><i class="fa fa-plus"> Add new <span style="text-decoration:underline;">Object</span></button>
Button behaviour is different then <input type="button"> or <input type="submit">. You can append elements in <button>.
You can also use <button> tag for submit. You need to also give the button a type of submit to capture the browser event.
<button type="submit">
<a>link</a>
<span>span</span>
</button>
EDIT: Why you should specify type of submit
<form>
<input />
<button type="button">not a submit button</button>
<button type="submit">submit button</button>
</form>
In this case, anyone looking at your code will know exactly which <button> is the actually submit button in a second. Also, if someone is going to get the form's submit button with CSS selector, one can easily do so by button[type="submit"]. Yes submit is the default type, but it is also the better practice for readability and easier for debugging.
I am not able to use <ul> <li> hover and click..
Inside <li> tag I have <button> tag not <a> tag.
I want same hover and click functionality in button tag as anchor only.
My Css :
.custom-anchor:hover {
color: #ffffff;
background-color: #3276b1;
text-decoration: none;
}
My HTML :
<div class="btn-group">
<button id="csr_duration_btn"
class="btn dropdown-toggle btn-xs btn-success"
data-toggle="dropdown">{{csrServiceModel.selectedDuration.name}}<i class="fa fa-caret-down"></i>
</button>
<ul id="comparision-chart-interval" class="dropdown-menu pull-right">
<li data-ng-repeat="duration in csrServiceModel.durations">
<button class="btn btn-link custom-anchor" data-ng-click="csrServiceModel.durationSelect(duration)" ng-disabled="duration.enabled">{{ duration.name }}</button>
</li>
</ul>
</div>
I tried to add same custom class for <li> tag also but it is not working.
It should work like below image :
Edited :
You can see ..... Some options are disabled in the lists.. Is there any way on click of disabled option list it should not do anything..
I want to prevent the event if disabled list option is clicked..
Please help...
It looks like formatting is done using bootstrap. Add following css rule:
#comparision-chart-interval li button {
width:100%;
}
First post here. I'm trying to override the link colors for Bootstrap buttons, but I can't get it to work. I actually got the background color to change, but I can't get the link colors to change. I also can't figure out how to space the buttons out more.
<span>
<button type="button" class="btn btn-default btn-lg">Resume</button>
<button type="button" class="btn btn-default btn-lg"> Twitter</button>
<button type="button" class="btn btn-default btn-lg">LinkedIn</button>
</span>
My css currently looks like:
.btn{
background-color:#d0d0d0;
text-align:center;
display:block;
}
To change the text colour of the BootStrap buttons, you'll actually have to target the <a> element inside of the .btn. For example:
.btn a{
color:#000;
}
This would change button link text to black. Hope this helped, let me know if you have any questions!