Change button:active in css - html

how i can change button to have border-radius: 6px; and to by active marked when i will select it. Here is my HTML code and i also have CSS. When i make <button class:active i get only active button without css style
<div align="center">
<label>Period selection</label>
<button class="button: active" id="Day" style="height:25px; width:60px; margin: 4px 2px" type="submit" onclick="setImage('1');">Day</button>
<button class="button: active" id="Week" style="height:25px; width:60px; margin: 4px 2px" type="submit" onclick="setImage('2');">Week</button>
<button class="button: active" id="Month" style="height:25px; width:60px; margin: 4px 2px" type="submit" onclick="setImage('3');">Month</button>
</div>
.ctButton,
.button,
body div.ui-dialog div.ui-dialog-buttonpane div.ui-dialog-buttonset button.ui-button,
.ui-dialog .ui-button,
a.button,
#ctPageContent a.button,
#ctPageContent a.button:hover {
background-color: #2B2B2B;
border: 0px;
display: inline-block;
padding: 3px 10px 4px;
color: #fff;
text-decoration: none;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
border-bottom: 1px solid rgba(0,0,0,0.25);
position: relative;
cursor: pointer;
margin: 4px 2px;
}

The : indicates a pseudo-class (pr pseudo-element). It is not part of the class name.
:active means "While being clicked on" (or otherwise activated).
If you want to match a class in the document, then give it a regular class name (and preferably not one that could be confused with a pseudo-class):
<button class="current"
Then use a class selector in the CSS:
.current { ... }

Add this to your css
.button:active{
border-radius: 6px;
}
In your html just add the below code.
NOTE- :active :hover should be in your css, not in your class attribute. Hence remove :active from your class attribute as below
<div align="center">
<label>
Period selection </label>
<button class="button" id="Day" style="height:25px; width:60px; margin: 4px 2px" type="submit" onclick="setImage('1') ;">
Day</button>
<button class="button" id="Week" style="height:25px; width:60px; margin: 4px 2px" type="submit" onclick="setImage('2') ;">
Week</button>
<button class="button" id="Month" style="height:25px; width:60px; margin: 4px 2px" type="submit" onclick="setImage('3') ;">
Month</button>
</div>

change
class="button:active"
to
class="button"
and add to your css
button:active {
// your button:active styling
}

In CSS, colons have a special meaning: they introduce pseudo-classes.
Therefore, if you want to select the following HTML by its class...
<button class="button:active"></button>
...you must escape the colon:
.button\:active
.button\:active {
background-color: #2B2B2B;
border: 0px;
display: inline-block;
padding: 3px 10px 4px;
color: #fff;
text-decoration: none;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
border-bottom: 1px solid rgba(0,0,0,0.25);
position: relative;
cursor: pointer;
margin: 4px 2px;
}
<button class="button:active">Button</button>

Related

background color on search glyphicon

I'm trying to get my the background color on my search glyph to take up the full box. Ideally, it should look like this.
However, it currently looks like this.
I'm not sure what's going on.
Here's my html (I'm using Bootstrap).
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-6">
<div id="custom-search-input">
<div class="input-group col-md-12">
<input type="text" class="form-control input-lg" placeholder="Search by user name, member types, genres..." />
<span class="input-group-btn">
<button class="btn btn-info btn-lg" type="button">
<i class="glyphicon glyphicon-search"></i>
</button>
</span>
</div>
</div>
</div>
Edited to add my CSS:
#custom-search-input{
padding: 3px;
border: solid 1px #E4E4E4;
border-radius: 6px;
background-color: #fff;
height: 75%;
}
#custom-search-input input{
border: 0;
box-shadow: none;
}
.input-group-btn{
background: #E44424;
}
#custom-search-input button{
margin: 2px 0 0 0;
background: #E44424;
box-shadow: none;
border: 0;
color: black;
padding: 0 8px 0 10px;
border-left: solid 1px #ccc;
}
#custom-search-input button:hover{
border: 0;
box-shadow: none;
border-left: solid 1px #ccc;
}
#custom-search-input .glyphicon-search{
font-size: 23px;
}
You have padding in
#custom-search-input{
padding: 3px;
}
That's the reason.
You should instead have it on
.form-control{
padding: 3px;
}
if you need padding on input
Here's Plunker

Bootstrap Panel Headings

I am trying to remove the border that creates the panels Body but having some issues finding it.
Here is the code for my panel:
<div class="panel">
<div class="panel-heading"> <span class="panel-title"><i class="icon-user"></i> Training Team</span><button type="button" name="addProjectMember" class="btn btn-mini pull-right"><i class="icon-plus"></i> Add Project Member</button></div>
<div name="trainingTeamBody" style="display:none;" class="panel-body">
<span name="teamError"><br><div class="alert alert-warning"><center>No Project Members Assigned</center></div></span>
<table name="teamTable" class="table table-hover" style="display: none;">
<thead>
<tr>
<th><small>Member</small></th>
<th><small>Role</small></th>
<th><small>Supervisor</small></th>
<th><small>Date Assigned</small></th>
<th><small>Who Assigned</small></th>
<th><small>Action</small></th>
</tr>
</thead>
<tbody name="teamTableResults"></tbody>
</table>
</div>
</div>
In the image above, All I would like its the gray bar which would be what I'd consider to be the heading. If there are no results to show, I simply want the bar to appear without the outline of the body.
As a test, I removed the body completely from the code but the border was still there.
Is there a part of the panels CSS that is causing this that I can overwrite?
This is for Panels in Bootstrap 2 which I did by using the following CSS:
panel {
padding: 15px;
margin-bottom: 20px;
background-color: #ffffff;
border: 1px solid #dddddd;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}
.panel-heading {
padding: 10px 15px;
margin: -15px -15px 15px;
font-size: 17.5px;
font-weight: 500;
background-color: #f5f5f5;
border-bottom: 1px solid #dddddd;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
.panel-footer {
padding: 10px 15px;
margin: 15px -15px -15px;
background-color: #f5f5f5;
border-top: 1px solid #dddddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel-primary {
border-color: #428bca;
}
.panel-primary .panel-heading {
color: #ffffff;
background-color: #428bca;
border-color: #428bca;
}
Here you go - http://jsfiddle.net/AndrewL32/9ema30gx/2/
.panel {
border: 0 !important;
}
Hope that helps :)

span not working on Bootstrap button

I have a bootstrap button over which I want to have a bubble with a number, much like a notification that appears on an app icon in an iphone.
My mark up for the button is:
<button class="btn btn-warning view-sl-btn" type="button"><span class="notification, red">6</span>View Shortlist</button>
And the Css for the span is:
.btn.span {
position: absolute;
background-color: #f56c7e;
border: 1px solid #ce4f5e;
padding: 2px 5px 1px;
margin-left: -2px;
margin-top: -16px;
border-radius: 100px;
color: #fff;
text-shadow: 0px 1px 0px rgba(0,0,0,0.2);
font-size: 11px;
-webkit-box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
-moz-box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
-o-box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
}
.btn.span.red {
background-color: #f56c7e;
border-color: #ce4f5e;
}
But it doesn't seem to work.
Any advice will be much appreciated.
Cheers
The issue is with your CSS declaration:
.btn.span
(Would apply styles to all elements with the 'btn' class AND the 'span' class.)
<div class="btn span" />
You want this:
.btn span
(Which would style all spans that are descendants of an element with the 'btn' class.)
Use the following instead
.btn span
Yes, .btn span is the proper syntax for the css since span is an HTML tag. The use of the period before the span would suggest it is a css class, which it is not.

CSS form doesn't appear to have any line breaks

I'm working on styling my website forms and found a tutorial that seems to work up to a point... The tutorial includes code to have hover hints, and this code is causing things to get ugly. Instead of the fields all lining up under one another they seem to be attempting to position themselves one right after another and wrapping all the way down the window.
Here is the code element for the feature in question followed by the CSS...
HTML
<form id="defaultform" class="rounded" name="form2" method="post" action="<?php echo $editFormAction; ?>">
<h3>Contact Form</h3>
<div class="field">
<label for="hostess_fname">First Name:</label>
<input type="text" class="input" name="hostess_fname" value="" id="hostess_fname" />
<p class="hint">Enter your name.</p>
</div>
<div class="field">
<label for="email">Last Name:</label>
<input type="text" class="input" name="hostess_fname" value="" id="hostess_lname" />
<p class="hint">Enter your email.</p>
</div>
<input type="submit" value="Lookup Hostess" />
<input type="hidden" name="Lookup" value="form2" />
CSS
#defaultform {
width: 500px;
padding: 20px;
background: #f0f0f0;
overflow:auto;
/* Border style */
border: 1px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
/* Border Shadow */
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
label {
font-family: Arial, Verdana;
text-shadow: 2px 2px 2px #ccc;
display: block;
float: left;
font-weight: bold;
margin-right:10px;
text-align: right;
width: 120px;
line-height: 25px;
font-size: 15px;
}
#defaultform.input{
font-family: Arial, Verdana;
font-size: 15px;
padding: 5px;
border: 1px solid #b9bdc1;
width: 300px;
color: #797979;
}
.hint{
display: none;
}
.field:hover .hint {
position: absolute;
display: block;
margin: -30px 0 0 455px;
color: #FFFFFF;
padding: 7px 10px;
background: rgba(0, 0, 0, 0.6);
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
I just updated the code with more of the HTML from a shorter form that I was trying with the same CSS. I also added some more of the CSS code. I'm getting the same behavior. I'm still confused on selectors and how those are defined and stuff.
I see what you're doing now that you've added your code. It's a pretty simple fix, but hard to catch:
CSS
.field{
clear:both;
}
Here's the jsFiddle

Padding differences in anchor element and input element with same style

I have the next input and anchor elements:
<input type="submit" class="button" name="add" value="Button 1" />
<a class="button" href="cpanel.php">Button 2</a>
The css is:
input, textarea, select, button
{font-size: 100%;font-family: inherit;margin:0;padding:0;}
.button{
border: 1px solid #9B9B9B;
background-color: #DADADA;
padding: 0;
margin: 0 20px 5px 0;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
cursor: pointer;
}
The problem is that firefox shows both buttons with different padding:
I use a reset css code and I define a line-height attribute in body.
Thanks.
try:
input::-moz-focus-inner
{
border: 0;
padding: 0;
}