Textbox flush with buttons - html

I'm trying to create an input box with two buttons on the left and right. Here's the frankenstein monster I have so far: http://vegan.fm/clone/?p=8679
It should look like the textbox+button here: http://appsumo.com/welcome/?next=/
I've been able to get it to align sort of well, but then it seems to just get jumbled on a different OS or computer.
I've done this by obsessively tweaking the padding and margin values, but my gut tells me there's a better practice. So far, I haven't found anything with a google/stackoverflow search. Any help is appreciated. Thank you.
Update: The problem I'm having is the "height" value for the button and the input box are exactly the same, yet the button is always higher than the input box.
Here's some code:
.halfbutton {
border-top: 1px solid #f0d995;
background: #806a43;
padding: 0px 3px 0px 3px;
background: -webkit-gradient(linear, left top, left bottom, from(#d1ad51), to(#806a43));
background: -moz-linear-gradient(top, #d1ad51, #806a43);
height: 30px;
width:25px;
-webkit-border-radius: 8px 0 0 8px;
-moz-border-radius: 8px 0 0 8px;
border-radius: 8px 0 0 8px;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color: white;
font-size: 14px;
font-family: Helvetica, Arial, Sans-Serif;
text-decoration: none;
vertical-align: middle;
}
And for the input box:
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<input style="z-index:1999;height:30px;margin:0 -.1em 0 -.1em;border:1px solid;border-color:#a1a1a1;" size="20" type="text" name="s" id="s" value="<?php ... />
</form>

Dunno have i understood the question right.
To make it seems like in your link you need to use background img in your input form;
You may make it look like inset input form with css3
in css
#inputform{
background-color: #f7f7f7;
-moz-box-shadow:inset -2px 2px 10px rgba(0, 0, 0, .1);
-webkit-box-shadow:inset -2px 2px 10px rgba(0, 0, 0, .1);
box-shadow:inset -2px 2px 10px rgba(0, 0, 0, .1);
...
}
There's a link in the comments with your code from website;

At the moment, the alignment seems ok to me (in Chrome) but there's no border on the input so it's hard to tell what's going on.
My comment though - right now you have the add'l search options as a dropdown to the left of the input field, then the "more" dropdown with add'l choices attached to the right of the input. I'd argue this doesn't follow the typical user's model of search boxes where immediately to the right of the input is the submit/options button. Maybe move the options button to the right, then float the "more" as a separate button to the right of that (or below).
Just a thought.

Related

CSS/HTML table rendering issue, p element shows up behind td

I am trying to make a basic calendar / resource manager where you can drag a P element into the calendar on a given day.
The calendar generates html dates through PHP. Just a fairly basic TABLE, TR, TD structure.
There are draggable P elements, these are job orders you can drag on any given day (TD) in the calendar.
A javascript prompt shows up and you can select the duration of this job order.
The javascript function simply changes the width of the P element to overlap the table structure horizontally according to the job duration. Simply setting style.borderRight ="none" on these TDs to make it look tidy. Also a max-width is defined so that the TD wont resize when the P is resized.
The problem is that it actually shows up behind the columns it's supposed to overlap. The only way I could fix that was having no background-color on the TD. As you can see below there is a background color on the saturdays and sundays.
The P shows up behind those. (not the text however). Why is this? I guess the problem is that it's actually just appended on one TD and tries to overlap the others, probably makes for some rendering problems.
Any quick CSS fix for this?
Overlapping but showing up below
td.slot {
width: 70px;
max-width: 70px;
margin: 0px;
padding: .5em;
vertical-align: top;
border-style: solid;
border-color: #c9cacc;
border-width: 0px 1px 1px 0px;
-webkit-box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.09);
-moz-box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.09);
box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.09);
}
p.order {
text-align: center;
font-size: 11px;
background-color: #a9c5f2;
padding: .5em;
vertical-align: top;
white-space: nowrap;
border-style: solid;
border-color: gray;
border-width: 1px;
width: 70px;
}

CSS Glow on focus textarea is not working correctly

Hi I'm designing a website and run into trouble on my css I'm kinda new on this css thing and its kinda weird that the css rule I made for input text is not working correctly on my text area here is my css
input[type="text"], textarea {
background: rgba(255,255,255,0.3);
border: none;
border-radius: 4px;
padding: 2%;
color: white;
}
input[type=text]:focus, textarea:focus {
box-shadow: 0px 1px 1px #f2dede inset, 0px 0px 8px #dff0d8;
}
and this is how it looks like on the browser
the text field Name has the correct glow but its weird that the textarea is not considering that they both have the same rule as what I pasted on my code above..
Try setting the following:
input[type=text]:focus, textarea:focus {
box-shadow: 0px 1px 1px #f2dede inset, 0px 0px 8px #dff0d8;
outline: none;
}
Some browsers set an outline on inputs, text areas etc on focus automatically and this most probably is the cause of your problem. Setting the outline to none should remove this behaviour.
this is because input has default style,when set your style,you can reset focus style:
*:focus {outline: none;}

Style file input

I want to update this file input to look like the image I've attached.
Currently I have this view:
http://davis-design.de/marktadresse/mein-profil.html
But I would like it to look like the following:
My current attempt:
<span class="btn">
<span class="fileupload-new">Bild auswählen</span>
<span class="fileupload-exists">Ändern</span>
<input type="file" name="bild" id="bild">
</span>
How would I go about styling the default file input element?
Just as a word of warning from past experience, certain methods of styling a file upload doesn't always work cross browser, and has given me some gray hair. But I believe the below solution should work for most cases
Based on the answer from #BjarkeCK
https://stackoverflow.com/a/9182787/1105314
Fiddle
http://jsfiddle.net/D9T4p/1/
Markup
<div style="padding:100px;">
<div class="uploadButton">
BILD AUSWÄHLEN
<input type="file" />
</div>
</div>
Javascript
$(function() {
$(".uploadButton").mousemove(function(e) {
var offL, offR, inpStart
offL = $(this).offset().left;
offT = $(this).offset().top;
aaa= $(this).find("input").width();
$(this).find("input").css({
left:e.pageX-aaa-30,
top:e.pageY-offT-10
})
});
});
CSS
.uploadButton input[type="file"] {
cursor:pointer;
position:absolute;
top:0px;
opacity:0;
}
.uploadButton {
position:relative;
overflow:hidden;
cursor:pointer;
/*** (Copied from the link you supplied) ***/
text-transform: uppercase;
font-size: 13px;
font-family: 'Roboto',Arial,sans-serif;
padding: 8px 22px;
display: inline-block;
-moz-border-radius: 2px;
border-radius: 2px;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
text-align: center;
vertical-align: middle;
cursor: pointer;
-webkit-box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.1) inset;
box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.1) inset;
color: #FFF;
background-color: #2561BA;
}
Update
CSS only solution:
http://geniuscarrier.com/how-to-style-a-html-file-upload-button-in-pure-css/
You can use jqtransform here to customize your input type here
There is a easy css-only solution. you don't need any javascript for it. so - just dont.
The keyword of the solution is: <label>.
Label? - Yes a label!
The simple HTML Element. You can easily style an <label> element.
Here is a sample:
HTML
<label for"foo"></label>
<input type="file" id="foo"/>
CSS
label {
cursor: pointer;
}
#foo {
height: 0.1px;
width: 0.1px;
z-index: -1;
}
You dont use the input element itself. You'll use the label instead. If you click on the label, you'll get referenced to the 'real' input element and its functionality.

FireFox buttons not linking

I am trying to link buttons using a button tag that is set to show a button made with CSS3.
The button works and display properly in Chrome and Safari but in FireFox the button shows but it doesn't link, it also messes up the style of the page a bit.
I know you use to not be able to use the
The link to the page is here http://pt11.com/index2.php?x=videos.html
Here is my HTML:
<head>
<link rel="stylesheet" type="text/css" href="videos.css" />
</head>
<br>
<div class="vidholder">
<div class="textbox">
<h2>Eythor Bender at TEDMED 2011</h2>
</div>
<div class="textbox2">
Eythor Bender's Ekso Bionics makes powered, wearable robots known as "exoskeletons" that boost human strength, endurance, and mobility. But can they help a paraplegic walk? Watch this incredible story.
</div>
<div class="img">
<img src="ted.png">
</div>
<button type="button" name="" value="" class="css3button">Watch Video</button>
</div>
<br>
</div>
Then the CSS for the button
button.css3button {
padding
margin:-3px 0px 0px 325px;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #ffffff;
padding: 10px 20px;
background: -moz-linear-gradient(
top,
#ff2819 0%,
#ab0000);
background: -webkit-gradient(
linear, left top, left bottom,
from(#ff2819),
to(#ab0000));
border-radius: 0px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border: 1px solid #7d0000;
-moz-box-shadow:
0px 1px 3px rgba(000,000,000,0.5),
inset 0px 0px 2px rgba(255,255,255,0.7);
-webkit-box-shadow:
0px 1px 3px rgba(000,000,000,0.5),
inset 0px 0px 2px rgba(255,255,255,0.7);
text-shadow:
0px -1px 0px rgba(000,000,000,0.4),
0px 1px 0px rgba(255,255,255,0.3);
}
Is there a reason that you need the button element? Why not just use
<a class="css3button">
and change your css selector to match. That would apply the styles to the anchor, remove the need for the button element, and it would work in all browsers.

Why HTML input element gets resized by the browser?

I'm trying to make a simple search form on my website and I'm using the input HTML element. But it is acting really weird.
It gets resized by the browser no matter which size I specify in the style. In the example below I've got an input element with the width of 180px, but the browser renders it as 147px. :/
Do you know what could be the problem?
Here's a video example and the code below: http://screencast.com/t/WwqAQDmofhf
<div id="search" style="background-color:#000; height:100px;">
<input style=" background: none repeat scroll 0 0 #FFFFFF;
border: medium none;
border-radius: 5px 5px 5px 5px;
color: #666666;
float: left;
line-height: normal;
margin: 6px;
padding: 6px 27px 6px 6px;
width: 180px;
z-index: 40;"
type="text" name="searchQuery" value="Search friend" onfocus="this.value=''" />
</div>
The meaning of 'width' depends on the page's box model. Traditionally width has included paddings and borders, but the standard model now excludes them.
If you do not have a correct doctype in your html, then most browsers would default to traditional box model, and you would be left with a box of 147px. Adding a doctype would fix it and force other layout to be standard-compliant.
<!DOCTYPE html>
<html><head><body>
<div id="search" style="background-color:#000; height:100px;">
<input style=" background: none repeat scroll 0 0 #FFFFFF;
border: medium none;
border-radius: 5px 5px 5px 5px;
color: #666666;
float: left;
line-height: normal;
margin: 6px;
padding: 6px 27px 6px 6px;
width: 180px;
z-index: 40;"
type="text" name="searchQuery" value="Search friend" onfocus="this.value=''" />
</div></body></html>
It's probably to do with:
padding: 6px 27px 6px 6px;
27px of right padding + 6px of left padding + 147px of reported width = 180px
Have you tried it with Javascript turned off in your browser?
Does it happen in this example?