CSS Button has a border - html

I am trying to define a custom css button for my search form. I cant figure out why this particular button has a strange border around it? I need to get it removed but cannot figure out where it is coming from within the css..code and fiddle below.
/* Define Search Button */
button.button-search::-moz-focus-inner { padding:0; border:0; } /* FF Fix */
button.button-search { -webkit-border-fit:lines; } /* <- Safari & Google Chrome Fix */
button.button-search { position:absolute; right:10px; top:8px; }
button.button-search > span {
background: #3399CC; /* Old browsers */
box-shadow:1px 1px 0 #a4a4a4;
display:block;
float:none;
width:88px;
height:32px;
line-height:30px;
text-align:center;
font-size:15px;
color:#fff;
text-align:center !important;
}
button.button-search span span { padding:0; float:none; }
button.button-search:hover > span {
opacity:0.8 !important;filter:alpha(opacity=80) !important;
box-shadow:1px 1px 0 #a4a4a4;
}
.header .form-search button.button-search { }
.header .form-search button.button-search > span { }
.header .form-search button.button-search:hover > span { }
.header .form-search button.button-search span span { }
.header .form-search button.button-search:hover span {}
<div class="header">
<div class="form-search">
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button-search"><span><span>Search</span></span></button>
</div>
</div>
http://jsfiddle.net/fnysccad/
Thanks

You are applying the CSS to the spans inside the button, so the default styling for the button is still being used:
Get rid of all the messy <span>, and, as #Christoph said in the comments, type="submit" can be omitted, as it is the default functionality of a button:
<div class="form-search">
<button title="<?php echo $this->__('Search') ?>" class="button-search">Search</button>
</div>
Apply the CSS to the input:
button.button-search::-moz-focus-inner { padding:0; border:0; } /* FF Fix */
button.button-search { -webkit-border-fit:lines; } /* <- Safari & Google Chrome Fix */
button.button-search { position:absolute; right:10px; top:8px; }
button.button-search {
background: #3399CC; /* Old browsers */
box-shadow:1px 1px 0 #a4a4a4;
display:block;
float:none;
width:88px;
height:32px;
line-height:30px;
text-align:center;
font-size:15px;
color:#fff;
text-align:center !important;
border:none;/*Removes the border*/
}
http://jsfiddle.net/q3t2srfg/1/

Button has border, and background by default.
Remove them, and will be good.
But i dont think its valid to add span into button.
Solution is here: (css)
button.button-search { background: transparent; border: none; position:absolute; right:10px; top:8px; }

This is happening because of default style you need to override it by define your own class for example 'change':-
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button-search change"><span><span>Search</span></span></button>
button.button-search.change{
border:0;
padding:0;
}
Updated fiddle :-http://jsfiddle.net/ynwypqw2/

Looks like solutions requiring a different html structure work for you. But to answer the original question, here's the css solution for getting a button to respect your custom styles:
button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
padding: 0;
border: 0;
}
This tells Safari and Chrome (webkit), Firefox (moz), and standards-compliant browsers to not enforce their default button styles, and then makes sure there's no padding or border.

If you add the following code above your code, it will work:
button {
border: medium none;
margin: 0;
padding: 0;
}
This code reset some of the default styles in the browsers.

You need to do something like this, if i understood your question:
.button-search{border:0px;background-color:inherit;}
.button-search:focus{outline:none;}

use this .button-search{ border: 0; padding: 0; }

Related

Click on Button shows blue rectanle. Moreover, button unhovers after closing a modal

I am just having two problems with call to action button that appears on mobile version of website.
Firstly, the blue border appers around the button. First time I am seeing this blue border on click on my button. Is it possible to remove it?
Secondly, button unhovers after closing modal. I just need to click outside of button to unhover it.
Here is the page http://novostroyka.shahar.uz/complex/citylife
<a href="#" onclick="return false;" class="float2" data-toggle="modal" data-target="#myModal">
<i class="fa fa-phone my-float2" style="font-size:25px;"></i>
</a>
#media (min-width:800px) {
.float2{
visibility:hidden;
}
}
#media (max-width:768px) {
.float2{
position:fixed;
width:60px;
height:60px;
bottom:100px;
right:27px;
background-color:#24ac36;
color:#FFF;
border-radius:50px;
text-align:center;
box-shadow: 2px 2px 3px #999;
animation: bot-to-top 2s ease-out;
z-index:1000;
}
.my-float2{
font-size:24px;
margin-top:18px;
}
.ul2{
position:fixed;
right:30px;
padding-bottom:20px;
bottom:65px;
z-index:100;
}
.ul2 .li2{
list-style:none;
margin-bottom:10px;
}
.ul2 .li2 .a2{
background-color:#24ac36;
color:#FFF;
border-radius:50px;
text-align:center;
box-shadow: 2px 2px 3px #999;
width:60px;
height:60px;
display:block;
}
.ul2:hover{
visibility:visible!important;
opacity:1!important;
}
.modal-body2{
position: relative;
padding: 20px;
}
The 'blue outline' may be to highlight that a button is focused or active. To remove it, use the following snippet:
button,
button:active,
button:focus {
outline: none;
-webkit-tap-highlight-color: transparent;
}
You can replace button with any relevant HTML element, such as a, a:active, a:focus { ... } etc for links.
This will hide any :focus outline (outline: none), and hide the :active 'tap highlight' on smartphones (-webkit-tap-highlight-color: transparent;) meaning your button should no longer show a blue outline on either desktops or smartphones.
I am not quite sure what you mean by your second question?

Creating a hover description box that triggers the effect outside the carousel div

I have a carousel menu and i want to create a description box when you hover over each element. The problem is that when i put the position of it on absolute it does not show the whole description box that goes outside the div. When i put the position on absolute the description box scrolls down when i scroll down the page and i dont know what to do about it. Has anyone any idea how to solve this?
CSS
.carousel-component {
position:relative;
overflow:hidden; /* causes the clipping */
display:none; /* component turns it on when first item is rendered */
}
.carousel-component ul.carousel-list {
width:10000000px;
position:relative;
z-index:1;
}
.carousel-component .carousel-list li {
float:left;
list-style:none;
overflow:hidden;
}
.carousel-component .carousel-clip-region {
overflow:hidden; /* Secret to the clipping */
margin:0px auto;
position:relative;
}
/**
* ==============================================================================
* Safe to override. It is safe to override background, padding, margin, color,
* text alignment, fonts, etc. Define a separate CSS file and override your style
* preferences.
**/
.carousel-component {
/* padding:0px;*/
/* -moz-border-radius:6px;*/
/* color:#618cbe;*/
}
.carousel-component ul.carousel-list {
margin:0px;
padding:0px;
line-height:0px;
}
.carousel-component .carousel-list li {
text-align:center;
margin:0px;
padding:0px;
}
.carousel-component {
padding: 0px 16px; /*8px 16px 4px 16px;*/
margin:0px;
}
.carousel-component .carousel-list li {
margin:0px 10px;
width:78px; /* img width is 78 px + a.border-left (1) + a.border-right(1) + img.border-left (1) + img.border-right (1)*/
height:78px; /* image + row of text (87) + border-top (1) + border-bottom(1) + margin-bottom(4) */
/* margin-left: auto;*/ /* for testing IE auto issue */
}
.carousel-component .carousel-list li a {
display:block;
outline:none;
}
div.desc_box {
display: none;
border-radius:5px;
border: #000000;
position: absolute;
padding:0.5rem;
background: #000000;
color: white;
height:150px;
width: 450px;
margin-bottom: 25%;
overflow-x: visible;
-webkit-transform: translateY(1em);
transform: translateY(1em);
}
.carousel-component .carousel-list li img {
display:block;
}
.carousel-component .carousel-prev {
position:absolute;
top:20px;
z-index:3;
cursor:pointer;
left:5px;
}
.carousel-component .carousel-next {
position:absolute;
top:20px;
z-index:3;
cursor:pointer;
right:5px;
}
Html and Jquery
https://gist.github.com/teaxhillari/71f68a15c8820715e367
If you need to show your popup boxes on your page in a specific, non-scrolling position relative to the browser window then you can use position: fixed for instead of position: absolute. Fixed position positions it relative to the browser window, and so it won't move with scrolling. But, if you do need it to be positioned relative to a parent element, then this won't work because the parent element essentially becomes the browser window.

Make display:flex responsive while retaining alignment

Hello fellow stackers.
I have used display:flex on a div which sits in the middle of the Y and X div, as you can see here. However I want to make it responsive, which it NEARLY is! When I resize the browser wide down to around 250 pixels the div and the text within the div just stops responding.
Now I understand that if I remove display:flex it will allow the text to continue responding. However, when I do so the alignment drops to the bottom of the div. The misalignment doesn't display when I remove display:flex though which leads me to believe that there is something in my code which relies on display:flex to retain the alignment. You can view the website here. Please find the code below, and the Jsfiddle in the link above. Much obliged.
#registry {
background-color:#fff;
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
.pane {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
min-height:50vh;
padding:6rem 1.5em;
position:relative;
width:100%
}
.pane .pane-title, .pane .title-section {
margin-bottom:2em;
}
.pane-title h2{
font-family: 'Abril Fatface', cursive;
text-transform: uppercase;
font-size: 1.875em;
}
#media (max-width:222px){
.pane-title h2{
font-size:1.3em;
}
}
.pane .pane-content {
max-width:68em;
margin-left:auto;
margin-right:auto
}
.pane .pane-content::after {
clear:both;
display:table
}
.pane .pane-row {
display:block;
margin-bottom:3em
}
.pane .pane-row::after {
clear:both;
display:table
}
.pane.flex {
display:-webkit-flex;
display:-ms-flexbox;
display:flex;
flex:1;
flex-direction: column
-ms-flex-line-pack:center;
-webkit-justify-content:center;
-ms-flex-pack:center;
justify-content:center
}
.pane.flex .pane-content {
-webkit-align-self:center;
-ms-flex-item-align:center;
align-self:center
}
#registry {
background-image:url(http://kadeem.london/Content/Image/KL.png);background-color:#e94378;
-webkit-background-size:cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size:cover;
min-height:110vh
}
#registry .pane-content {
max-width:48em;
background-color:#fff;
padding:6em 2em
}
#media screen and (min-width:768px) {
#registry .registry-description {
float:left;
display:block;
margin-right:2.12766%;
text-decoration: none;
width:65.95745%;
margin-left:17.02128%
}
#registry .registry-description:last-child {
margin-right:0
}
#registry p {
text-align:center
}
}
.registry-description p a{
text-decoration: none;
border-bottom: 1px solid #000;
color: #000;
}
.registry-description p a:hover{
text-decoration: none;
background-color: #000;
color: #fff;
}
<section id="registry" class="pane flex">
<div class="pane-content">
<div class="pane-title">
<h2>Get In Touch</h2>
<span class="underline"></span>
</div>
<div class="registry-description">
<p>I hope your liking my website so far. If you would like to work with me you can give me a call or message me on the email below. Alternatively you can view more of my articles, designs, and projects.
</p>
<br>
<button class="connn"><a>contact#kadeem.london</a>
</button>
</div>
</div>
</section>
Your contact button (contact#kadeem.london) is what is stopping the content from resizing down any further.
However, having said that, you probably don't need to worry about supporting devices that narrow - all devices I'm aware of are at least 480px wide in portrait orientation.

How to equal height of <select> and <button> element with padding

I want to make both elements 'select' and 'button' have the same height.
JS Fiddle
HTML
<select><option>...</option></select><button>Button</button>
CSS
* {
font-size:100%;
}
select, button {
border:1px solid gray;
padding:.4em .6em;
margin:0;
//box-sizing:border-box; (did not help...)
}
JS Fiddle
Right now it looks like this:
But it should look like this:
How can I achieve the desired outcome with changing the CSS?
Add some bigger padding for button:
button{
padding: 1px;
}
Just make sure in all browsers elements are shown equal. Form elements tends to be Browser specific, so they may wary. Better put dropdown above fake drowpdown image and make it with opacity = 0, in that way you will get dropdown appearance same in all browsers.
Give padding differently.. May be like this
select, button {
border:1px solid gray;
margin:0;
}
select {
padding:.35em .6em;
}
button {
padding:.4em .6em;
}
Define height as like this
select, button {
border:1px solid gray;
padding:.4em .6em;
margin:0;
height:40px; // add this line
}
Demo
select, button {
border:1px solid gray;
margin:0;
padding:0 .6em; //updated
height:2.3em; //new
box-sizing:border-box; //new
}
* {
font-size: 100%;
box-sizing: border-box;
}
button::-moz-focus-inner {
border:0;
padding:0;
}
select, button {
border: 1px solid gray;
padding: 5px;
margin: 0;
}
button {
padding: 6px;
}

print an html/css form on a legal size paper

I need to be able to print my form on an 8.5" x 11" piece of paper. The form needs to have all the form fields blank. Then my customers are going to sign the form. I then need to be able to fill in all the form fields on the computer and then print all the form fields into the form.
How can i do it in html and css.
You should design a form in a normal page, and use CSS3 Media Styles to style the page for "print" format. E.g.
#media print { /* Just for printer */
body { font-size: 10pt }
}
#media screen { /* Just for computer */
body { font-size: 13px }
}
Codex - Styling for Print is a good blog post on setting up your page styles for print.
From there, you can easily add simple JavaScript to cause a print action:
Print this page
or
<body onload="JavaScript:window.print();">
ghayes method would work.
But using CSS3 Media Styles is not supported in IE before 9 ( More Info Here )
But all browsers do support media types EX:
<link href="/css/print.css" media="print" type="text/css" rel="stylesheet" />
I would stick to media types to for my Print Stylesheets.
I will give an example of a simple print stylesheet (one I use on my site)
/*
*********************************
* PRINT ONLY STYLES ***
*********************************
*/
/* TAGS */
html, body{
font-size:12pt !important; } /* !important Tags are to overide other CSS
when printed */
h1{ font-size:18pt !important; }
h2{ font-size:16pt !important; }
h3{ font-size:14pt !important; }
h4{ font-size:12pt !important; }
h5, h6{ font-size:10pt !important; }
* {color:#000 !important; }
/* HIDE HEAD, FOOTER, AND SIDEBAR ELEMENTS */
#top, .social, #pre_footer_back_ground, #right_sidebar, .full_shadow,
.slideshow, .light_button, .dark_button, .addthis_toolbox, img
{ display:none; }
/*SHOW PRINT ONLY AREAS*/
#logo-print, #copyright-print, #contact-print {display:block;}
/* DISPLAY ABSOLUTE LINKS */
a[href^="http://"]:after{content: " (" attr(href) ") ";}
a {text-decoration:none;}
/* FORMS FOR PRINT */
#form textarea, #form input, #form select{ border:1px solid #fff; color:#fff; }
#form textarea:focus, #form input:focus{ background-color:#fff; }
.form textarea, .form input, .form select{ border:1px solid #fff; color:#fff; }
.form textarea:focus, .form input:focus{ background-color:#fff; }
#form, .form{ clear:both; }
#form form, .form form{ padding-top:10px; }
#form textarea{ float:right; margin-bottom:10px; padding:6px 5px 6px 5px; width:450px; height:130px; overflow:hidden; }
.form textarea{ float:right; margin-bottom:10px; padding:6px 5px 6px 5px; width:450px; height:130px; overflow:hidden; }
#form input{ float:right; margin-bottom:10px; padding:6px 5px 6px 5px; width:450px; font-size:13px; line-height:18px; }
.form input{ float:right; margin-bottom:10px; padding:6px 5px 6px 5px; width:450px; font-size:13px; line-height:18px; }
#form input, #form textarea, .form input, .form textarea{
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
}
/* ETC Add your print only styles */
You can easily customize your forms to be able to only show the form and easily have the user print out the form. Then you would take that paper that is signed and fill in the information and run in through the printer again.
Might take a bit of work to get everything correct (like alignment etc) but it should not be super hard.
So basically create the form as you normally would (HTML) and style it (CSS) for your site then change the CSS in your print only style.
Hope this Helps. =>