100% width layout not working properly in a fluid layout - html

1st sorry if the title is not 100% at the pont, i really have no idea how to compose it.
Anyway here is a simple problem with 100% width layout. I have a form that is inside a fluid container, it has - 1 input, 1 select, 1 button, they all are align inline (horizontal)
the problem when i minimize the window the button and then the select list they move down. which i dont want that.
Here is a example in the fiddle http://jsfiddle.net/4GSLE/ you can minimize the html part and you will see the problem.
How to make them to be in one line and not to move down?
.main {
max-width: 1200px;
margin: 0px auto;
background-color: #eee;
line-height: 50px;
padding: 10px;
}
form {
padding: 0 0 0 0;
margin: 0 0 0 0;
display: block;
}
.clear {clear: both;}
input, select {
float: left;
height: 50px !important;
padding: 0 10px;
width: 66% !important;
border: 1px solid #d6d8db;
margin-right: 20px;
}
input.button {
height: 54px !important;
padding: 0 10px;
margin-top: -1px !important;
width: 125px !important;
border: 1px solid #d6d8db !important;
background: #333;
cursor: pointer;
color: #fff;
}
select {
width: 200px !important;
height: 52px !important;
}
html:
<div class="main">
<form>
<input type="text" name="" value="search" />
<select>
<option>select</option>
</select>
<input type="submit" name="" value="Search now" class="button" />
</form>
<div class="clear"></div>
</div>

Some CSS tweaking to the form, input, and select selectors should do the trick.
form {
padding: 0;
margin: 0;
display: block;
white-space: nowrap;
}
input, select {
display: inline-block;
height: 50px;
padding: 0 10px;
width: 66%;
border: 1px solid #d6d8db;
margin-right: 20px;
}
Demo Here
Side note: Unless you really need them, all those !important declarations will end up causing more trouble than solving issues. I'd avoid !important as much as possible.

Related

Aligning with Custom CSS & Gravity Form in Wordpress

I can't seem to make an element move in CSS. It's a form with a background and it's centered. I can't see what I'm doing wrong.
#skyformbox {
width: 50%;
margin: 0 auto;
margin-top: 0px;
clear: both;
border: 3px solid #000000;
padding-top: 20px;
background: #ccc url(http://www.ultraframehomeimprovements.co.uk/wp-
content/uploads/2018/07/Sky-box.png);
overflow: auto;
padding: 5;
left: 2000px;
}
<div align="left">
<div id="skyformbox">
[gravityform id="12" title="false" description="false"]
</div>
</div>
Why are you positioning 2000px left? As far as I know the "left" property will only work if the positioning is set to absolute...
Anyway try this:
#skyformbox {
width: 50%;
margin-left: 0px;
margin-top: 0px;
clear: both;
border: 3px solid #000000;
padding-top: 20px;
background: #ccc url(http://www.ultraframehomeimprovements.co.uk/wp-content/uploads/2018/07/Sky-box.png);
overflow: auto;
padding: 5;
left: 2000px;
}
Setting the margin-left to 0px did the trick for me (assuming that what you're trying to do here is to get the form to align to the left side of the page).

How can I make curved form text inputs in HTML & CSS?

I have a project to create a website designed in PhotoShop. I want to create a to textbox in HTML and CSS which looks like this:
As you can see, there is no problem with the background or fonts; the problem is the textbox. How can I create textboxes with these curves?
* {
box-sizing: border-box;
-moz-box-sizing: border-box;
}
div {
background: #444;
direction: rtl;
width: 300px;
padding: 20px;
}
label {
width: 100%;
color: #fff
}
input {
border-radius: 0 2em;
padding: 0 10px;
width: 100%;
border: none;
line-height: 2em;
margin-bottom: 20px;
}
textarea {
border-radius: 0 4em;
padding: 0 10px;
width: 100%;
border: none;
line-height: 2em;
margin-bottom: 20px;
}
input[type="submit"] {
max-width: 100px;
}
<div class="wrapper">
<label>Name</label>
<input type="text" />
<label>Email</label>
<input type="text" />
<label>Message</label>
<textarea></textarea>
<input type="submit" value="Submit" />
</div>
This is how to get the shape in your image. You will need to learn a bit about border-radius.
The following is an example:
div#test {
border: thin solid #666;
width: 8em;
height: 2em;
border-radius: 0 2em 0 2em;
}
<div id="test"> </div>
The border-radius property is responsible for rounding corners. It can be very sophisticated, but the simple one here will do the job. You will just need to adjust some of the values.
The four values in the border-radius property represent the radius of the individual borders, clockwise from the top-left corner.

CSS strange thing happening when scaling

this is my first post here. I don't know how to explain my problem because I don't really know what is causing my CSS code to break. It would be easier to show you in a photo.
So I have a div tag and input and div child elements inslide. One of the div is static 32px x 32px and I am calculating its width with calc(100% - 32px), but when scaling some pixels aren't filled with the input.
Here's a photo of the problem: http://imgur.com/TkRFLde
This occurs when the zoom is not divisible by 100. For example it breaks on 110%, 150% and 175%. But it is right when the zoom is 100%, 200%, 300%...
Heres my code:
<div class="search">
<input type="text" value="Search" class="search-text" />
<div class="search-icon" ></div>
</div>
CSS:
.search {
height: 32px;
width: 250px;
}
.search-text{
float:left;
width: calc(100% - 55px) !important;
display: inline-block !important;
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
margin: 0;width: 196px;
}
.search-icon{
display: inline-block !important;
background-color: #ACB6BE;
height: 30px;
width: 31px;
float:right;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
cursor: pointer;
border: 1px solid #acb6be;
}
input[type=text] {
border-radius: 5px;
border: 1px solid #acb6be;
min-width: 180px;
color: #acb6be;
padding: 0 10px;
height: 30px;
background-color: #fff;
font-weight: 600;
}
Or jsfiddle: http://jsfiddle.net/39VDR/1/
The problem happens because when you zoom, your values will not be integer anymore. This means that rounding will take place and the outer container (.search) will be 1px larger than you would expect.
You can remove the float:right on the .search-icon and it will work ok.
You can see it here:
http://jsfiddle.net/39VDR/4/
.search-icon{
display: inline-block;
background-color: #ACB6BE;
height: 30px;
width: 31px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
cursor: pointer;
border: 1px solid #acb6be;
font-size:12px;
vertical-align: top;
}
Still, as mentioned, you can remove the !important if you just add more specificity to your selectors.

How to make this HTML object in a middle and one line?

Here you can see the problem: http://jsfiddle.net/kAQrX/1/
I want the magnifier, search text and search box (input) to display in one line, and in a middle of the #search div.
I'm out of ideas now.
Use the css background-image property and a left padding, instead of an image tag! :)
E.g.
.search_content {
background: url('http://www.iconeasy.com/icon/thumbnails/System/WebGloss%203D/Magnifier%20Icon.jpg') no-repeat;
padding-left: 55px;
}
JSFiddle
Try This :
.magnifier {
width: 35px;
height: 35px;
margin: 3px;
float:left; //<----
}
See Feedle http://jsfiddle.net/kAQrX/2/
You can display it inline, or as inline-block. See this fiddle
there you go:
HTML:
<div id="search">
<div class="search_content">
<span class="search_text">SEARCH:</span>
<input type="text" name="query" class="search_box">
<img src="http://www.iconeasy.com/icon/thumbnails/System/WebGloss%203D/Magnifier%20Icon.jpg" class="magnifier">
</div>
</div>
CSS:
#search {
background: url("images/search.png") no-repeat;
width: 382px;
height: 41px;
margin-right: 10px;
float: right;
}
.magnifier {
width: 35px;
height: 35px;
margin: 3px;
vertical-align:middle;
}
.search_text {
margin-left: 3px;
text-shadow: 0px 0 black, 0 1px black, 1px 0 black, 0 1px black;
color: #FFF;
font-weight: bold;
}
.search_box {
width: 162px;
height: 33px;
padding: 0px 12px 2px 10px;
}
.searchbox_content {
margin-top: 10px;
}
You can add the following:
.searchbox_content {
display: inline;
}
to get the 3 elements in one line.
To get them into the center of #search you can add the text-align-Attribute:
#search {
text-align:center;
}

Why css margins don't work?

I have been struggling with this annoying piece of code. You'd think I'd had enough practice with css, but as always, it is temperamental with me.
My problem is as follows, I have the following css:
.FORM ul li label {
margin-top: 50px; //<--------------THE PROBLEM
height: 20px;
max-height: 20px;
width: 100px;
min-width: 100px;
}
.FORM ul li {
list-style: none;
width: 500px;
height: 100px;
min-width: 500px;
min-height: 100px;
background: #ddd;
border-top: #eee 1px solid;
border-bottom: #bbb 1px solid;
padding: 10px 10px;
margin: auto;
}
ul {
background: #ccc;
padding: 10px 10px 10px 10px;
width: 530px;
margin: auto;
}
body {
background: #cfc;
padding: 0px;
margin: 0px;
}
.FORM {
background: #fcc;
}
the html it controls is:
<form class="FORM">
<ul>
<li>
<label for="workersAddr">Worker's Address:</label>
<input type='text' id='workersAddr' class='validate[required,minSize[5]]'/>
</li>
</ul>
</form>
notice how in the image below the margin-top: 50px; have no effect at all?
how do I solve this issue?
Vertical margins and paddings only have effect in block-level elements and <label> is an inline element. You can either emulate it with other properties or convert into an inline-block:
.FORM ul li label {
display: inline-block;
}
Use the line-height css attribute on the label. This will not increase the height of any visible background on the label, but will allow you to effectively add a margin.