I have this div that is absolute-positioned under a fixed div. I then tried to insert a form with an <input> in it, and it won't let me input anything.
#navbar {
width: 100%;
padding: 30px;
position: fixed;
background-color: #0066CC;
box-shadow: 0px 10px 40px 3px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0px 10px 40px 3px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0px 10px 40px 3px rgba(0, 0, 0, 0.5);
}
#main_index {
left: 8%;
right: 8%;
width: 85%;
top: 300px;
z-index: -1;
min-height: 100px;
position: absolute;
border: 1px solid #CCCCCC;
background-color: #FFFFFF;
}
<div id="navbar"><center><b>NAVBAR</b></center></div>
<div id="main_index">
<div id="index_login">
<form action="login" method="post">
<input type="text" required="required" name="username">
<br />
<input type="password" required="required" name="password">
</form>
</div>
</div>
I believe at least part of your problem is the center tag has been depriciated. Use a style sheet with the attribute "align:center;" and apply it to your DIV.
I think you should try with:
#navbar {
width: 100%;
padding: 30px;
position: fixed;
z-index: 2;<----------------------bigger than #main_index
background-color: #0066CC;
box-shadow: 0px 10px 40px 3px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0px 10px 40px 3px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0px 10px 40px 3px rgba(0, 0, 0, 0.5);
}
#main_index {
left: 8%;
right: 8%;
width: 85%;
top: 300px;
z-index: 1;<--------------------- positive
min-height: 100px;
position: absolute;
border: 1px solid #CCCCCC;
background-color: #FFFFFF;
}
I'm not really sure how the rest of your html looks like but are you sure that the #navbar isn't overflowing over your #main_index div. Try adding for testing purposes:
height:100px;
overflow:hidden;
on your #navbar css style and see what happens.
Related
Hi everyone thank you for taking the time. I am trying to add the nav-bar that is out of place inside of a container. This is the HTML
<div class="container-login100" style="background-image: url('images/packages.jpg');">
<div class="wrap-login100 p-l-55 p-r-55 p-t-80 p-b-30">
<div class="nav-container">
<nav class="nav-bar-outer">
<buttton type="button" class="hamburger-btn"> HERE </buttton>
</nav>
</div>
<form class="login100-form validate-form">
<!--css form content-->
And this is the CSS.
[ Nav-Bar ]*/
.nav-container{
position: absolute;
width: auto;
}
.nav-bar-outer{
background-color: #ffbf00;
padding:5px;
height:50px;
width:390px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
background-position: center;
background-size: cover;
position: relative;
}
.wrap-login100 {
border-bottom-right-radius: 10px;
border-bottom-right-radius: 10px;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
width: 390px;
background: rgba(0, 0, 0, 1);
overflow: hidden;
box-shadow: 0 3px 20px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 3px 20px 0px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 3px 20px 0px rgba(0, 0, 0, 0.1);
-o-box-shadow: 0 3px 20px 0px rgba(0, 0, 0, 0.1);
-ms-box-shadow: 0 3px 20px 0px rgba(0, 0, 0, 0.1);
}
.login100-form {
width: 100%;
}
.p-l-55 {padding-left: 55px;}
.p-b-30 {padding-bottom: 30px;}
.p-r-55 {padding-right: 55px;}
.p-t-80 {padding-top: 80px;}
.p-b-37 {padding-bottom: 37px;}
So I think because there is padding in the black container the bar is not positioning itself like I would like to how could it fit inside the container without me having to change the padding (since the content inside would get messed up)
Please add this new CSS to your CSS file.
.wrap-login100 {
position: relative;
}
.nav-container {
position: absolute;
width: auto;
left: 55px;
right: 55px;
}
.nav-bar-outer {
width: 100%;
padding: 0;
}
I'm trying to figure out how to beautifully group divs together to create more creative shapes outline. Basically I wanted to make a textbox with shared border. I've maded a ugly sample over THERE
.white-box{
width: 300px;
}
.white-box-tab{
position: relative;
left: 8px;
width: 45%;
height: 25px;
background: #fff;
box-shadow: 1px -1px 1px rgba(0, 0, 0, 0.1), -1px 0px 1px rgba(0, 0, 0, 0.1);
border-radius: 3px 3px 0px 0px;
text-align: center;
}
.white-box-tab:after{
content:'';
width:100%;
height:1px;
position:absolute;
background:white;
bottom: -0.5px;
left: 0px;
}
.white-box-body{
width: 100%;
height: 200px;
background: #fff;
box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.1), -1px -1px 1px 0px rgba(0, 0, 0, 0.1);
border-radius: 0px 3px 3px 3px;
}
<div class="white-box">
<div class="white-box-tab">
The title
</div>
<div></div>
<div class="white-box-body">
</div>
</div>
However, the way I acheive it just feels quite ugly and unexpandable. Is there a better way to complete task like that?
I would simply do not apply bottom border to element and move it down by other div border width:
.white-box {
width: 300px;
}
.white-box .box {
border: 1px solid #ddd;
background-color: white;
}
.white-box .box.white-box-tab {
border-bottom: none;
position: relative;
top: 1px;
margin-left: 5%;
width: 70%;
z-index: 10;
}
.white-box-body {
height: 300px;
}
<div class="white-box">
<div class="box white-box-tab">
The title
</div>
<div></div>
<div class="box white-box-body">
</div>
</div>
I need to make this using only css and css3 drop shadows
Please help to make like this using css...
Image : http://technocodes.us/Lab/Html/vidbees/img/frame.png
ADDED MORE TO THE ANSWER:
I looked into this. I believe this is the solution. Not using images at all, only CSS.
This is not the full solution, but I believe this is the solution. You should get the idea and solution to run from from here I think:
This is the result:
(Here is the fiddle: http://jsfiddle.net/uwfL5azw/3/ )
Here is the place that inspired me, and I lend code from: http://www.themeshock.com/css-drop-shadow/
The HTML:
<div class="main-box">
<div class="box_shadow">Here is my content
<div class="sh_bottom"></div>
</div>
</div>
The CSS:
.main-box {
padding: 0 0 0 30px; /*just for the box's content*/
}
.sh_bottom:before {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 150px;
height: 100px;
z-index: -1;
background: rgba(0, 0, 0, 0.2);
box-shadow: -20px 30px 10px rgba(0, 0, 0, 0.3);
-moz-box-shadow: -20px 30px 10px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: -20px 30px 10px rgba(0, 0, 0, 0.3);
-webkit-transform: skew(-10deg,-10deg) translate(40px,-15px);
transform: skew(-10deg,-10deg) translate(40px,-15px);
-moz-transform: skew(-10deg,-10deg) translate(40px,-15px);
}
.sh_bottom:after {
content: "";
position: absolute;
right: 0;
bottom: 0;
width: 150px;
height: 100px;
z-index: -1;
background: rgba(0, 0, 0, 0.2);
-moz-box-shadow: 20px 30px 10px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 20px 30px 10px rgba(0, 0, 0, 0.3);
box-shadow: 20px 30px 10px rgba(0, 0, 0, 0.3);
-moz-transform: skew(10deg,10deg) translate(-40px,-15px);
-webkit-transform: skew(10deg,10deg) translate(-40px,-15px);
transform: skew(10deg,10deg) translate(-40px,-15px);
}
.box_shadow {
padding:20px;
width: 374px;
min-height: 200px;
margin: auto;
background: #ccc;
border: 5px solid white;
position: relative;
-webkit-box-shadow: rgba(0, 0, 0, 0.8) 0px 0px 1px; box-shadow: rgba(0, 0, 0, 0.8) 0px 0px 1px;
}
MORE:
See fiddle: http://jsfiddle.net/uwfL5azw/5/
This is only a little example of drop shadows.
For an example more helpful, I need of you code, or a web page with a result similar at your.
div {
width: 300px;
height: 100px;
background-color: yellow;
box-shadow: 10px 10px 5px #888888;
}
<div>Hello world!</div>
Thank you and bye,
Giacomo
How about this it is made of two divs
#box {
width:200px;
height:200px;
background:grey;
margin:20px;
border:2px solid white;
box-shadow:0px 16px 20px black;
}
#b {
position:absolute;
width: 0px;
height: 0px;
border-left: 250px solid transparent;
border-right: 250px solid transparent;
border-bottom: 100px solid white;
margin-left:-130px;
margin-top:-17px;
}
<div id="box"></div>
<div id="b"></div>
Without using two divs [Fiddle]http://jsfiddle.net/udq412fe/3/)
#box {
width:200px;
height:200px;
background:grey;
margin:20px;
border:2px solid white;
box-shadow:0px 16px 20px black;
}
#b {
position:absolute;
width: 0px;
height: 0px;
border-left: 250px solid transparent;
border-right: 250px solid transparent;
border-bottom: 100px solid white;
margin-left:-130px;
margin-top:-17px;
}
<div id="box"></div>
Hi I'm doing a live search with ajax. I want to align the form and the ul.
here my form
<div align="right">
<form method="post" action="" id="search" class="kb-search">
<input type="text" id="kbsearch" name="kbsearch" placeholder="Knowledge Base" autocomplete="off">
<input type="hidden" name="action" value="searchKB"/>
</form>
<ul id="results"></ul>
</div>
and here my css
.kb-search {
width: 250px;
}
#results {
text-align:left;
width: 250px;
background: #ffffff;
padding: 5px 10px;
max-height: 400px;
overflow: auto;
position: absolute;
z-index: 99;
border: 1px solid #A9A9A9;
border-width: 0 1px 1px 1px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
}
How can I do this:
You can set the parent div position to relative.. then to the #results add right: 0.. I think this will do..
Define your parent div position:relative;
#results{
top: 8px;
left: 2px;
}
Demo
You parent div needs to have position: relative so that you can position elements inside relevant to it. So
<div align="right" style="position: relative;">
Then
#results {
position: absolute;
left: 0;
top: 25px; /* e.g Offset it by the height of the input field */
...
}
The best and most reusable way to do this is:
div {
position: relative;
}
#results {
position: absolute;
top: 100%;
right: 0;
}
By setting the results to top: 100% ensures that the results will always sit underneath the search box regardless of the height of it.
This is by far the better way, as putting a specific pixel value for top is quite brittle and unresuable.
Fiddle
maybe this is your Answer:
<style>
#kbsearch {
width: 250px;
}
#results{
text-align:left;
width: 234px;
background: #ffffff;
padding: 5px 10px;
max-height: 400px;
overflow: auto;
margin-top:-5px;
z-index: 99;
border: 1px solid #A9A9A9;
border-width: 0 1px 1px 1px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
}
</style>
and put this in body or other place what you like:
<div>
<form method="post" action="" id="search" class="kb-search">
<input type="text" id="kbsearch" name="kbsearch" placeholder="Knowledge Base" autocomplete="off">
<input type="hidden" name="action" value="searchKB"/>
</form>
<ul id="results">f</ul>
</div>
So #container is already centered, but I can't seem to get the <form> centered. I want to have everything inside the form horizontally centered and for some reason it's not working. I've tried every trick that I know.
<!-- Container Start -->
<div id="container">
<h1 class="signup-header-text">SIGN UP</h1>
<div class="clear"></div>
<form class="signup-form" action="#" method="post">
<div id="first_step">
<div class="form">
<label for="gender">You are:</label>
<br />
<select id="gender" name="gender" size="2">
<option value="1">Male</option>
<option value="2">Female</option>
</select>
<div class="clear"></div>
</div>
<div class="clear"></div>
<input class="submit" type="submit" name="submit_first" id="submit_first" value="" />
</div>
</form>
<div id="progress_bar">
<div id="progress"></div>
<div id="progress_text">0% Complete</div>
</div>
</div>
<!-- Container End -->
My CSS
#container {
height: 410px;
min-height: 410px;
min-width: 756px;
width: 756px;
overflow: hidden;
position: absolute;
top: 50%;
left: 50%;
margin-top: -205px; /* Half the height */
margin-left: -378px; /* Half the width */
background: #e9e5e5;
border: solid #dcdcdc 2px;
outline: solid #c4c4c4 1px;
-webkit-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
-moz-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
}
Added text-align: center;
#container {
height: 410px;
min-height: 410px;
min-width: 756px;
width: 756px;
overflow: hidden;
position: absolute;
top: 50%;
left: 50%;
margin-top: -205px; /* Half the height */
margin-left: -378px; /* Half the width */
background: #e9e5e5;
border: solid #dcdcdc 2px;
outline: solid #c4c4c4 1px;
-webkit-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
-moz-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
text-align: center;
}
http://jsfiddle.net/xjL7t/
Simply center your text.
#container {
height: 410px;
min-height: 410px;
min-width: 756px;
width: 756px;
overflow: hidden;
position: absolute;
top: 50%;
left: 50%;
**text-align:center;**
margin-top: -205px; /* Half the height */
margin-left: -378px; /* Half the width */
background: #e9e5e5;
border: solid #dcdcdc 2px;
outline: solid #c4c4c4 1px;
-webkit-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
-moz-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
}
Try this:
.signup-form {
margin: 0 auto;
}
Find the element you want to center, set a width, and set margin: 0 auto on it.
.signup-form {
margin: 0 auto;
width: 100px;
}
http://jsfiddle.net/EXLSJ/
If you don't want to set a fixed width, follow these instructions to 'shrinkwrap' your container: How to make div not larger than its contents?
add
text-align:center;
float:center;
clear:center;
also works with left and right
Add text-align: center;:
#container {
height: 410px;
min-height: 410px;
min-width: 756px;
width: 756px;
overflow: hidden;
position: absolute;
top: 50%; left: 50%;
margin-top: -205px; /* Half the height */
margin-left: -378px; /* Half the width */
background: #e9e5e5;
border: solid #dcdcdc 2px;
outline: solid #c4c4c4 1px;
-webkit-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
-moz-box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
box-shadow: 0px 5px 15px rgba(48, 50, 50, 0.28);
**text-align: center;**
}