i have a layout problem.
i have this sample code:
<div class="frame"><div class="holder"><form class="newform">...<div class="button"><input type="submit"></div></form></div></div>
And this stylesheet:
form.newform{border:1px solid orange}
div.button{border:1px solid red;width:100%;position:relative;overflow:hidden;}
Now the submit button (red-box) will be displayed at the bottom of the form (orange-box). But i like to display it AFTER (eg. 10px after bottom line) the orange-box.
Maybe someone can help me to solve this problem.
Best regards
Tim
Edit:
This is the complete css part of form.newform
overflow:hidden;
height:1%;
background:url(../images/contentform.gif) repeat-y;
padding:0 0 2px;
border:1px solid orange;
i tried to add bottom:-10px; to the div.bottom but the submit button will be cut at the bottom line of the form. Adding a z-index:200 wont help.
One option would be to use CSS to specifically shift the position of the submit button. I've made up the below so it will probably look completely wrong, but play around with it.
HTML:
<input type="submit" id="submitbutton">
CSS:
#submitbutton {
position: relative;
bottom: -50px;
}
You cannot have a submit button outside the form element, it needs to be inside.
If you want two boxes, one orange and one red, with the orange one containing the form input fields and the red one containing the submit button, you should do something like this:
<div class="frame">
<form class="newform">
<div class="holder">
...
</div>
<div class="button">
<input type="submit">
</div>
</form>
</div>
And in your css
.holder { border:1px solid orange; }
.button { border:1px solid red; margin-top:10px; }
Related
Heres my problem how can i make my header looks better
Following is the coding ...!!
1 Index.php
<div class="header">
<div class="headerFont">Yo! Yo! Honey Singh..!!
</div>
<div class="Login">
<form>
Email :<input type="text">
Password :<input type="password">
<input type="submit" value="Login" >
<input type="button" value="register">
</form>
</div>
</div>
2 Web-Style.css
.header{
top:0;
left:0;
padding:10px;
background:#00688B;
width:100%;
height:footer-<length>;
box-shadow:2px 2x 5px #08298A;
border:1px solid black;
text-shadow:2px 2px black;
}
.header a{
color:white;
}
.headerFont{
font-family:MATURA MT ;
font-size:22px;
display:table-cell;
}
.Login{
display:block;
position:absolute;
top:15px;
right:50px;
}
3 Mobile-Style.css
.header {
width: auto;
}
Now i need to know how can i get button like the website[PIC] -> http://i.stack.imgur.com/vlx09.png
How do i make button visible on mobile but not on pc borwsers ..???
Create the button you want on the mobile version of the website.
Add CSS that makes the button invisible (eg, display: none).
Use CSS with media queries to show the button on mobile devices.
More details here:
http://mobile.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/
you can do this using javascript and checking the requesting browser's type.
You can detect mobile broswer's request using javascript like following.
if ((screen.width < 480) || (screen.height < 480)) {
location.replace('/mobile/');
/*Get buggon element by id and show it else hide it*/
}
or may be you can use following javascript to detent mobile browser and then hide the button.
https://github.com/miohtama/detectmobile.js
I am using a wrapper but I am pretty confused. I want the two resultbox divs to be in line with the submit div.
Take a look here:
http://jsfiddle.net/QtVwr/
What am I doing wrong?
I'm not very familiar with CSS.
Part of the problem is that there are issues with your HTML. Here's a start:
make sure all the divs are closed.
remove the floats from your css
add display:inline-block;
remove the inline styles from your HTML.
correct the .wrapper class to be .wrapper1 (matching the HTML)
So, this is more what you want, I assume:
.wrapper1 {
height:70px;
width: 800px;
background: #ffffff;
border: 1px solid grey;
color: #BDBDBD;
}
.resultbox {
width: 300px;
background: #ffffff;
color: #BDBDBD;
display: inline-block;
}
.submit {
height:15px;
width: 32px;
margin-top:10px;
background: #ffffff;
border: 1px solid;
color: #BDBDBD;
display: inline-block;
}
and the HTML
<div class="wrapper1">
<div class="resultbox" style="" >
<div class="locationresult" style="" form action="weezyresults.php" method="post">
<input type="text" name="search" size="36" value="" style="" />
</div>
</div>
<div class="resultbox" style="" >
<div class="locationresult" style="" form action="weezyresults.php" method="post">
<input type="text" name="search" size="36" value="" style="" />
</div>
</div>
<div class="resultbox" style="width:35px;" >
<div class="submit"></div>
</div>
</div>
Example: http://jsfiddle.net/QtVwr/2/
You will still need to fiddle with it. But this is a start.
To make div inline you should use the following CSS style:
.mydiv{ display: inline; }
Note: Change width of your wrapper (make it smaller) and you will see the results
There are several issues with the code you have provided.
you have defined css rules for a class wrapper but use class wrapper1 in your html
class wrapper doesn't have enough width for both of the result boxes plus the submit
There are extra quotes on the second result box style="margin-left: 5px; margin-top: 3px;""
form tags are malformed and being intertwined with your div tags
form tags aren't closed
locationresult div tag isn't closed
floats need to be cleared
here is a fiddle
http://jsfiddle.net/e3dg6/
The width of your results boxes combined exceeds the width of your wrapper. You need to either make the wrapper wider or reduce the width on the resultboxes.
Why do you have the submit div within a resultbox div?
Why the margin-left:10px, only with the first div?
I'd do it like this:
<div id="wrapper">
<div class="resultbox"></div>
<div class="resultbox"></div>
<div id="submit"></div>
</div>
And set the width and height of the wrapper, and let the other divs float. It's just a longshot, not exactly sure what you're trying to accomplish. I just think your nesting is not okay.
I have created a simple layout with Html and CSS which is like below :
CSS
.search-box{border:1px solid gray;padding:
5px;border-right:5px solid gray;padding-right:30px;
width:60%;font-size:14px;}
.search-box:focus{outline:none;}
.search-buton{background-color:gray;
border:1px solid gray;padding:5px;font-size:14px;
cursor:pointer;color:#fff;width:10%;}
.search-buton:hover{background-color:#575E5B;border:1px solid #575E5B;}
.left{float:left; border:1px solid gray; width:68%;padding:10px;}
.right{float:right; border:1px solid gray;width:28%;padding:10px;}
HTML
<div class="right">
<input class="search-box" type="text" placeholder="ASP.NET MVC, JQuery, Ajax, etc." />
<input class="search-buton" type="submit" value="Search" />
</div>
<div class="left">
</div>
<div style="clear:both;"></div>
See the JSFiddle sample :
http://jsfiddle.net/tugberk/uuVuW/
As you can see, I am unable to see them smoothly. Some screen resolutions, it is perfect. But when I zoom in inside the browser, it is where the things get messy.
I thought about fixing this with CSS3 media queries but I am sure there is some CSS trick which solve this problem for me. Any thoughts?
BTW, Any suggestion for the title of this question would be great. It is
not so creative I think.
You need to use percentages for the padding as well because this affects the overall width
Here's an example:
http://jsfiddle.net/uuVuW/2/
This explains the box model:
http://www.w3.org/TR/CSS2/box.html
you can write like this :
.left{
border:1px solid gray;
padding:10px;
overflow:hidden;
padding: 10px;
}
.right{
float:right;
border:1px solid gray;
width:28%;
padding:10px;
margin-left:20px
}
check this http://jsfiddle.net/sandeep/uuVuW/3/
Eventually, our team would like to move away from tables, but it seems like div tags are so much harder to use. In the above image, the layout was created using a table, but I cant figure out how to get a basic column structure working using div tags. How can I get those buttons on the same line? HTML newbie here.
Not too difficult:
HTML:
<form id="login">
<div>
<label for="user">Username:</label>
<input id="user" type="text" size="20">
</div>
<div>
<label for="pass">Password:</label>
<input id="pass" type="password" size="20">
</div>
<div>
<input id="cancel" type="reset" value="Cancel">
<input id="submit" type="submit" value="Login">
</div>
</form>
CSS:
#login {
background-color: #FEFEDD;
border: 3px solid #7F7F7F;
display: inline-block;
padding: 20px;
text-align: right;
}
#login div {
padding: 5px;
}
#login label {
font-weight: bold;
margin-right: 5px;
}
#login #cancel {
float: left;
}
Live Demo
To be short, if you want to put many elements with div tags in the same line you should give for each div a left float and a width. For example:
<div style="width:50px; float:left;"> Element 1</div>
<div style="width:50px; float:left;"> Element 2</div>
...
As bad as it is to use tables for positioning elements on a page, forms is one exception I often make. Sure you can float your DIVs, but you're going to write a lot more code to do that than using tables. Plus we're talking about a tabular format with rows and columns. If you're not supposed to use tables for a tabular format, then why have the tags in the HTML at all?
If you give the elements a position:absolute then you can set the left: value and the top:value to align the buttons.
div#cancelbutton {
position: absolute;
top:50px;
left:30px;
}
div#loginbutton {
position:absolute;
top:50px;
left:300px;
}
This will place the element quote: relative to the first parent element that has a position other than static.
Check out http://www.w3schools.com/Css/css_positioning.asp
Maybee is better to use float:let then display: inline-block; because IE9 could display textboxes in two rows.
Check http://interestingwebs.blogspot.com/2012/10/div-side-by-side-in-one-line.html for examples.
I am trying to get my searchbox to look like that of facebook, where the button looks like it's inside the textbox. Please see the facebook home page.
I am using jquery ui and the graphics with it, for the button, problem is I think it adds borders to the button is creates, hence there is this separation between the text input and the button, anyway to get around this?
Here is my search form
<div class="div-search-form" style="display: inline; float: right;"><form method="get" id="search_form" class="" action="/searches">
<input type="text" value="Search" name="q" id="q" class="search-term" style="border: medium none;">
<span class="small-button"><a id="search_button" href="#" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" aria-disabled="false" title="Search"><span class="ui-button-icon-primary ui-icon ui-icon-search"></span><span class="ui-button-text">Search</span></a></span>
</form>
</div>
UPDATE
I think I am getting there.
Here is my css
.search-button {
background-position: -160px -112px;
display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat;
background-image: url(images/ui-icons_ff0084_256x240.png);
float:left;
border-left: 0 !important;
background-color: white;
width:16px;
}
.search-term {
padding:1px 5px 1px 20px;
border: 0 !important;
float:left;
background-image: url(images/ui-bg_flat_0_eeeeee_40x100.png);
}
.search-term:focus{
background-image: none;
}
.div-search-form {
margin-right: 0;
float:right;
margin-top:5px;
}
AND THE markup
<div class="div-search-form"><form method="get" id="search_form" class="" action="/searches">
<input type="text" value="Search" name="q" id="q" class="search-term">
<a class="search-button" id="search-button" href="#"> </a>
</form>
</div>
Notice that unless I put a &nbps; the background image of the anchor tag doesn't show up. wonder why?
Also, Not sure how to make them both the same size and bigger in height. Right now they are both 16px in height, but If I play with the padding the alignment goes out of whack.
Essentially what you need to do is create an image that mirrors the style of the input field on the left.
You will float the input field next to the button.
For the input field on the left control the CSS so there is not a right border, also make sure you add some padding, so that the text doesn't run into the button.
input.search-term { float:left; border:1px solid #CCCCCC; border-right:none; padding:5px; }
On your image do not have a left border
.smallbutton a { float:left; border:1px solid #CCCCCC; border-left:none; background:url(../imagepath); disiplay:block; height:XXpx; width:XXpx; }
The trick isn't as much about a technical way to do it, rather being creative with the images and CSS you use to accomplish the goal.