HTML/CSS Make a Progress Bar - html

I am trying to make a progress bar as is shown here in the about section however I am just lost.
I can make a bar and a box but neither look anywhere near as good as that and I cannot for the life of me get them to be beside each other with equal height. I just keep getting something along the lines of
What I am trying to achieve in case website goes down:
.myskills {
width: 45vw;
height: 100%;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
justify-content: center;
height: 2vh;
}
.skillName {
background-color: blue;
width: 5vw;
float: left;
height: 100%;
font-size: 2em;
}
.meter {
float: left;
width: 80%;
height: 100%;
/* Can be anything */
position: relative;
background: #555;
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: hotpink;
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"></span>
</div>
</div>
</div>

This code below will give you the percentage sign on the right of the percentage bar. A lot of this is purely layering with hmtl/css.
Here are some links for layering and z-index:
https://www.tutorialspoint.com/css/css_layers.htm#:~:text=The%20CSS%20layers%20refer%20to,element%20should%20come%20at%20bottom.
https://www.w3schools.com/cssref/pr_pos_z-index.asp
https://css-tricks.com/almanac/properties/z/z-index/
.myskills {
width: 90%%;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
}
.skillLevel{
right: 0;
font-size: 1.7em;
position: absolute;
}
.skillName {
background-color: rgb(77, 252, 208);
float: left;
font-size: 2em;
}
.meter {
float: left;
width: 100%;
/* Can be anything */
position: relative;
background: rgb(218, 217, 217);
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: rgb(31, 134, 117);
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"><span class="skillLevel">90%</span></span>
</div>
</div>
</div>

Well, IMO you should use less vh and vw. Your font simply defines the height and the width of the text part. By removing them, you get something as you want as I understood (I also removed useless properties) :
.myskills {
width: 45vw;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
}
.skillName {
background-color: blue;
font-size: 2em;
}
.meter {
float: left;
width: 100%;
/* Can be anything */
position: relative;
background: #555;
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: hotpink;
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"></span>
</div>
</div>
</div>
Now, if it was my progress bar I'd use flex instead of width for .meter, I'd take a smaller font size and put padding to the text :
.myskills {
width: 45vw;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
}
.skillName {
background-color: blue;
font-size: 18px;
padding: 3px 10px;
}
.meter {
float: left;
flex: 1;
/* Can be anything */
position: relative;
background: #555;
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: hotpink;
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"></span>
</div>
</div>
</div>

Related

How can I make this container with buttons more responsive?

I'm looking to make div.box and button.navBtn responsive.
Currently when the page is resized to 871px width, the buttons instantly stack on top of each other and the long div.box is squished until it clashes into the buttons. The "final look" (around 500px wide) doesn't even look that bad honestly and is the ideal way this window would look on smaller screens. I'm just trying to make the transition to that size nicer.
Preferably I'd like the buttons to resize themselves gradually with div.box until they hit a certain width and then stack on top of each other however I can't figure out how to apply the correct media query to do this. I feel as if my divider is causing some type of issue a well with spacing but I'm not entirely sure. It does have some whitespace I can't get rid of and is set to 2em width.
I'm also not sure why div.main stops resizing once you hit around 495px width. I'm gonna make sure I use Bootstrap or something next time to avoid this...
Any help would be appreciated. Here's a big snippet of code:
html {
min-height: 100%;
}
body {
display: flex;
justify-content: center;
font-family: 'Lora', serif;
margin: .8em;
background-color: #151b20;
background-size: cover;
background-position: center;
background-attachment: fixed;
background-repeat: no-repeat;
overflow-y: scroll;
}
h1 {
color: rgb(250, 250, 250);
display: flex;
justify-content: center;
font-size: 3.5em;
margin-top: 0px;
margin-bottom: 10px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
h2 {
color: rgb(250, 250, 250);
display: flex;
font-size: 1.7em;
justify-content: center;
padding-top: 5px;
margin-bottom: 16px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
a {
color: rgb(250, 250, 250);
}
ul {
padding-left: 0px;
}
li {
color: rgb(250, 250, 250);
display: flex;
justify-content: center;
list-style: none;
font-size: 1.5em;
margin-bottom: 5px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
button {
background: rgba(0, 0, 0, 0);
background-image: url(Pictures/blank.png);
color: #a5afaa;
border: 3.5px solid transparent;
border-radius: .6em;
padding: 2.8em;
/* transition: all 0.2s; */
background-repeat: no-repeat;
}
button:hover {
border-color: #fff8cc;
box-shadow: 0em 0em 1em 0em #fff8cc;
cursor: url('Pictures/glove-lg.png'), auto;
}
.main {
border: solid 2px #939388;
border-radius: 10px;
background-image: url(Pictures/texture.png);
background-color: #0f0f3de8;
box-shadow: 0 0.1em 0.3em 0.1em rgba(0, 0, 0, 0.6);
margin-top: 20px;
}
.inner {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
margin: 20px;
}
.decoration {
outline: 2px solid rgba(128, 128, 128, 0.4);
outline-offset: -5px;
border-radius: 10px;
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: solid;
border-bottom-style: solid;
}
.box {
background-color: #080824;
box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.6);
border-radius: 3px;
margin: 30px;
padding: 1px;
}
.wrapper {
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
.navHome {
display: inline-block;
position: relative;
margin-top: 15px;
}
.navBtn {
border: solid 2px #939388;
background-image: none;
background-color: #0f0f3d;
width: 25em;
box-shadow: 0 0.1em 0.3em 0.1em rgba(0, 0, 0, 0.6);
}
.navText {
color: white;
font-family: 'Lora', serif;
font-size: 2em;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
line-height: 0em;
}
.divider {
display: inline-block;
width: 2em;
height: auto;
}
.aboutText {
color: white;
font-family: 'Lora', serif;
font-size: 1.5em;
text-align: center;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
line-height: 1.5em;
}
#about {
padding-top: 25px;
}
#homeList {
margin-bottom: 0px;
}
#homeBox {
padding: 30px;
padding-top: 20px;
}
#media screen and (max-width: 992px) {
h1 {
text-align: center;
padding: 3px;
}
}
<body>
<div class="wrapper">
<div class="main">
<div class="decoration">
<div id="about">
<h1>I mean, it kinda works...</h1>
<ul id="homeList">
<li>Long List Item #1</li>
<li>Long List Item #2</li>
</ul>
<div id="innerHome" class="inner">
<div id="homeBox" class="box">
<a href="" class="navHome">
<button class="navBtn">
<div class="navText">About</div>
</button>
</a>
<div class="divider"></div>
<a href="" class="navHome">
<button class="navBtn">
<div class="navText">Items</div>
</button>
</a>
</div>
</div>
</div>
</div>
</div>
For the buttons to resize themselves you can't give them an explicit width like you do in .navBtn. You need to make them have a certain percentage of the parent and when they hit their minimal witdh they wrap.
Without that change the best that can be done is making the parent smaller when the elements wrap like so:
#homeBox {
width: min-content;
}
#media (min-width: 992px) {
#homeBox {
width: auto;
}
}
html {
min-height: 100%;
}
body {
display: flex;
justify-content: center;
font-family: 'Lora', serif;
margin: .8em;
background-color: #151b20;
background-size: cover;
background-position: center;
background-attachment: fixed;
background-repeat: no-repeat;
overflow-y: scroll;
}
h1 {
color: rgb(250, 250, 250);
display: flex;
justify-content: center;
font-size: 3.5em;
margin-top: 0px;
margin-bottom: 10px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
h2 {
color: rgb(250, 250, 250);
display: flex;
font-size: 1.7em;
justify-content: center;
padding-top: 5px;
margin-bottom: 16px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
a {
color: rgb(250, 250, 250);
}
ul {
padding-left: 0px;
}
li {
color: rgb(250, 250, 250);
display: flex;
justify-content: center;
list-style: none;
font-size: 1.5em;
margin-bottom: 5px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
button {
background: rgba(0, 0, 0, 0);
background-image: url(Pictures/blank.png);
color: #a5afaa;
border: 3.5px solid transparent;
border-radius: .6em;
padding: 2.8em;
/* transition: all 0.2s; */
background-repeat: no-repeat;
}
button:hover {
border-color: #fff8cc;
box-shadow: 0em 0em 1em 0em #fff8cc;
cursor: url('Pictures/glove-lg.png'), auto;
}
.main {
border: solid 2px #939388;
border-radius: 10px;
background-image: url(Pictures/texture.png);
background-color: #0f0f3de8;
box-shadow: 0 0.1em 0.3em 0.1em rgba(0, 0, 0, 0.6);
margin-top: 20px;
}
.inner {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 20px;
}
.decoration {
outline: 2px solid rgba(128, 128, 128, 0.4);
outline-offset: -5px;
border-radius: 10px;
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: solid;
border-bottom-style: solid;
}
.box {
background-color: #080824;
box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.6);
border-radius: 3px;
margin: 30px;
padding: 1px;
}
.wrapper {
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
.navHome {
margin-top: 15px;
display: inline-block;
position: relative;
}
.navBtn {
border: solid 2px #939388;
background-image: none;
background-color: #0f0f3d;
box-shadow: 0 0.1em 0.3em 0.1em rgba(0, 0, 0, 0.6);
/* max-width: 25em; */
width: 25em;
}
.navText {
color: white;
font-family: 'Lora', serif;
font-size: 2em;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
line-height: 0em;
}
.divider {
display: inline-block;
width: 2em;
height: auto;
}
.aboutText {
color: white;
font-family: 'Lora', serif;
font-size: 1.5em;
text-align: center;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
line-height: 1.5em;
}
#about {
padding-top: 25px;
}
#homeList {
margin-bottom: 0px;
}
#homeBox {
padding: 30px;
padding-top: 20px;
}
#homeBox {
width: min-content;
}
#media (min-width: 992px) {
#homeBox {
width: auto;
}
}
#media screen and (max-width: 992px) {
h1 {
text-align: center;
padding: 3px;
}
}
<body>
<div class="wrapper">
<div class="main">
<div class="decoration">
<div id="about">
<h1>I mean, it kinda works...</h1>
<ul id="homeList">
<li>Long List Item #1</li>
<li>Long List Item #2</li>
</ul>
<div id="innerHome" class="inner">
<div id="homeBox" class="box">
<a href="" class="navHome">
<button class="navBtn">
<div class="navText">About</div>
</button>
</a>
<div class="divider"></div>
<a href="" class="navHome">
<button class="navBtn">
<div class="navText">Items</div>
</button>
</a>
</div>
</div>
</div>
</div>
</div>

Displaying images in new line using HTML/CSS

I'm trying to display 2 images in a line below a line of text, but they show up in the same line. I tried using the "clear: both" property and "display: block" property in the CSS style for the images. What am I missing?
I included a screenshot of what it looks like as well as the relevant section of the HTML code and the complete CSS stylesheet. The "media" class is what I am using for the images. They are showing on the same line as the section under the "Contacts" div.
screenshot of website here
body {
background-color: #63a4ff;
background-image: linear-gradient(315deg, #63a4ff 0%, #83eaf1 74%);
}
.fadeline {
background-color: white;
margin: 25px 20%;
width: 60%;
height: 1px;
}
.fadeline.white {
background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
}
.fadeline.black {
background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}
.row {
background-color: white;
margin: 0% 15% 0% 15%;
padding-bottom: 15%;
padding-top: 50px;
color: #586E95;
}
.header {
text-align: center;
padding-left: 40%;
}
#about {
text-align: center;
}
p {
margin: 0 auto;
display: block;
clear: both;
}
.example {
margin: 0 auto;
background-color: white;
border: 1px solid black;
border-radius: 10%;
outline: none;
width: 20%;
}
a,
a:hover {
text-decoration: none;
display: block;
}
img {
max-height: 90%;
max-width: 90%;
}
.media {
height: 55px;
width: 55px;
display: block;
margin: 0 auto;
}
<div id="contact" class="row text-center">
<h1 class="header">Contact</h1>
<div class="fadeline black"></div>
<p> Want to connect? Reach out with Facebook or LinkedIn.</p>
<div class='media'>
<a href='https://www.facebook.com/siddharth.gampa/'><img src='https://facebookbrand.com/wp-content/uploads/2019/04/f_logo_RGB-Hex-Blue_512.png?w=512&h=512'></a>
</div>
<div class='media'>
<a href='https://www.linkedin.com/in/siddharth-gampa/'><img src='https://image.flaticon.com/icons/svg/174/174857.svg'></a>
</div>
</div>
If you place both images in one div with the class .media then set that div to display: flex that should work.
Check out the example code below by clicking the Run code snippet
body {
background-color: #63a4ff;
background-image: linear-gradient(315deg, #63a4ff 0%, #83eaf1 74%);
}
.row {
display: flex;
flex-direction: column;
background-color: white;
margin: 0 15%;
padding: 50px 0;
color: #586E95;
}
.text-center {
text-align: center;
}
.heading {
text-align: center;
}
.fadeline {
background-color: white;
margin: 25px 20%;
width: 60%;
height: 1px;
}
.fadeline.white {
background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
}
.fadeline.black {
background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}
.media {
display: flex;
justify-content: center;
width: 100%;
}
a img {
width: 40px;
margin: 0 10px;
}
<div id="contact" class="row text-center">
<h1 class="heading">Contact</h1>
<div class="fadeline black"></div>
<p> Want to connect? Reach out with Facebook or LinkedIn.</p>
<div class='media'>
<a href='https://www.facebook.com/siddharth.gampa/'>
<img src='https://facebookbrand.com/wp-content/uploads/2019/04/f_logo_RGB-Hex-Blue_512.png?w=512&h=512'>
</a>
<a href='https://www.linkedin.com/in/siddharth-gampa/'>
<img src='https://image.flaticon.com/icons/svg/174/174857.svg'>
</a>
</div>
</div>
It looks like they're not below the text because they're in the same div with the row class.
Put them in a div below the row and it should work
Add a class to both images. For example
Class="img-1"
And
Class="img-2"
Make their position relative then push one of the images to the right. It may take some fiddling to get the locations correct

Change z-index order on a child element

I have problem with z-index value in child element.
Structure looks like this:
#header {
position: relative;
z-index: 2;
width: 100%;
height: 15vh;
display: block;
margin: 0 auto;
background-color: white;
color: #44a9ff;
padding: 0;
overflow: hidden;
border-bottom: 3px solid #44a9ff;
-webkit-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
}
#main {
position: relative;
z-index: 1;
width: 100%;
height: 75vh;
display: block;
margin: 0 auto;
overflow: hidden;
padding: 0;
background: url('img/main_bg.jpg') no-repeat center center;
background-size: cover;
border-bottom: 3px solid #44a9ff;
}
#box {
position: relative;
z-index: 10;
width: 40%;
height: 38vh;
background-color: #44a9ff;
float: right;
color: white;
display: block;
overflow: hidden;
}
<div id="nav">
<ul>
<li>..</li>
<li>..</li>
</ul>
</div>
<div id="main">
<div id="box">
</div>
</div>
Element #nav has z-index 2, because there is box shadow in the bottom. #main has z-index 1, because when is higher, shadow is not visible. And than there is #box, which has z index 3, because I need it to cover shadow from #nav. But it probably has value of z-index from #main, so it doesn't cover it. How could I fix this please?
Try taking #box out of #main and setting it absolute above with right & top coordinates:
#header {
position: relative;
z-index: 2;
width: 100%;
height: 15vh;
display: block;
margin: 0 auto;
background-color: white;
color: #44a9ff;
padding: 0;
overflow: hidden;
border-bottom: 3px solid #44a9ff;
-webkit-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
}
#main {
position: relative;
z-index: 1;
width: 100%;
height: 75vh;
display: block;
margin: 0 auto;
overflow: hidden;
padding: 0;
background: url('img/main_bg.jpg') no-repeat center center;
background-size: cover;
border-bottom: 3px solid #44a9ff;
background: green;
}
#box {
/* set it absolute */
position: absolute;
/* tweak coordinates to your benefit */
right: 8px;
top: 19vh;
z-index: 3;
width: 40%;
height: 38vh;
background-color: #44a9ff;
color: white;
display: block;
overflow: hidden;
}
<div id="header">
<div id="nav">
<ul>
<li>..
</li>
<li>..
</li>
</ul>
</div>
</div>
<div id="main"></div>
<div id="box"></div>
try moving #box out of #main and give it a custom css code to get it to the right position
<div id="nav">
<ul>
<li>..</li>
<li>..</li>
</ul>
</div>
<div id="box">
</div>
<div id="main">
</div>

Input field wide not working properly

My target output want same as like blow image.
My CSS and HTML:
header {
height: 40px;
width: 100%;
position: fixed;
background: #00A6E3;
top: 0;
left: 0;
border-radius: 0 0 10px 10px;
padding: 15px;
box-shadow: 0 2px 5px rgba(44, 62, 88, 0.15);
display: block;
z-index: 5;
}
header .todoitem {
width: 100%;
height: 100%;
float: left;
border: none;
border-radius: 5px;
background: rgba(255, 255, 255, 0.2);
text-indent: 20px;
}
header input::-webkit-input-placeholder {
color: #fff;
}
<header>
<input type="text" name="todoitem" class="todoitem" placeholder="Enter your activity...">
</header>
After write my code input left side showing properly but the right side not showing properly. From my knowledge right side need show 15px padding. But I can't understand what wrong with my code.
Two possible solutions:
First, you could add box-sizing: border-box to your styles. As it is, your header is set to match the entire width of its container, and then the padding is applied outside that, which is the default behaviour for box-sizing, and which makes the padding extend outside the limits of the container.
Some more reading on css-tricks.com.
You also need to adjust the height to allow for the new box model (total height now includes the height of the padding) - here's your updated code:
header {
box-sizing: border-box;
height: 70px;
width: 100%;
position: fixed;
background: #00A6E3;
top: 0;
left: 0;
border-radius: 0 0 10px 10px;
padding: 15px;
box-shadow: 0 2px 5px rgba(44, 62, 88, 0.15);
display: block;
z-index: 5;
}
header .todoitem {
width: 100%;
height: 100%;
float: left;
border: none;
border-radius: 5px;
background: rgba(255, 255, 255, 0.2);
text-indent: 20px;
}
header input::-webkit-input-placeholder {
color: #fff;
}
<header>
<input type="text" name="todoitem" class="todoitem" placeholder="Enter your activity...">
</header>
Option 2: if you prefer to keep the default box model, you can use a calculated width to compensate for the padding: set the width of header to calc(100% - 30px) (be careful to keep the spaces around the - if you choose this option).
This solution is for you.
body{
margin:0;
padding:0;
}
header{
height: 40px;
display:block;
background: #00A6E3;
border-radius: 0 0 10px 10px;
padding:15px 15px 15px 15px;
box-shadow: 0 2px 5px rgba(44, 62, 88, 0.15);
z-index: 5;
}
header .todoitem{
height: 100%;
width:100%;
display:block;
border: none;
border-radius: 5px;
background: rgba(255, 255, 255, 0.2);
text-indent: 20px;
}
header input::-webkit-input-placeholder{
color: #fff;
}
<header>
<input type="text" name="todoitem" class="todoitem" placeholder="Enter your activity...">
</header>
You can do something like this, too.
header {
height: 70px;
width: 100%;
position:fixed;
background: #00A6E3;
top: 0;
left: 0;
border-radius: 0 0 10px 10px;
padding: 15px;
box-sizing:border-box;
}
header .todoitem {
width: 100%;
height: 100%;
float: left;
border: none;
border-radius: 5px;
background: rgba(255, 255, 255, 0.2);
text-indent: 20px;
}
header input::-webkit-input-placeholder {
color: #fff;
}
<header>
<input type="text" name="todoitem" class="todoitem" placeholder="Enter your activity...">
</header>
I have used box-sizing:border-box so padding is included in total width, and increased height of header, accordingly... Main problem was that your padding actually increased width of header - so header width was over 100% (100% + padding).
More about box-sizing: https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
header {
height: 40px;
background: #00A6E3;
top: 0;
left: 0;
border-radius: 0 0 10px 10px;
padding: 15px;
box-shadow: 0 2px 5px rgba(44, 62, 88, 0.15);
display: block;
z-index: 5;
}
header .todoitem {
width: 100%;
height: 100%;
float: left;
border: none;
border-radius: 5px;
background: rgba(255, 255, 255, 0.2);
text-indent: 20px;
}
header input::-webkit-input-placeholder {
color: #fff;
}
<header>
<input type="text" name="todoitem" class="todoitem" placeholder="Enter your activity...">
</header>
header {
height: 40px;
width: 100%;
position: fixed;
background: #00A6E3;
top: 0;
left: 0;
border-radius: 0 0 10px 10px;
padding: 15px;
box-shadow: 0 2px 5px rgba(44, 62, 88, 0.15);
display: block;
z-index: 5;
}
header .todoitem {
width: 100%;
height: 100%;
float: left;
border: none;
border-radius: 5px;
background: rgba(255, 255, 255, 0.2);
text-indent: 20px;
}
header input::-webkit-input-placeholder {
color: #fff;
}
<header>
<input type="text" name="todoitem" class="todoitem" placeholder="Enter your activity...">
</header>
Try removing float:left, and add text-align:center to header, and text-align:left to .todoitem, then add margin values to .todoitem to position it where you want.
Width:100% and padding:2px;
doesn't goes well, It never does. Either reduce width to 98% or add padding as padding :15px 0;
header {
height: 40px;
width: 100%;
position: fixed;
background: #00A6E3;
top: 0;
left: 0;
border-radius: 0 0 10px 10px;
padding: 15px 0;
box-shadow: 0 2px 5px rgba(44, 62, 88, 0.15);
display: block;
z-index: 5;
}

Tabs with dropshadow only around active

Is there a way to realize the following kind of shadow with CSS only?
So far I only managed to draw the shadow around the complete box without the recess around the inactive tab:
The Code Here
HTML:
<div class="box">
<div class="tabs">
<span class="tab active">Bild</span>
<span class="tab">Text</span>
</div>
<div class="content"></div>
</div>
CSS:
.box {
width: 200px;
height: 250px;
box-shadow: 0 0 2.5px 2px rgba(0, 0, 0, 0.18);
margin: 16px;
}
.tabs {
height: 30px;
}
.tab {
display: inline-block;
width: calc(50% - 2px);
height: 30px;
text-align: center;
line-height: 30px;
}
.tab:not(.active) {
/* Should be removed in the final solution with correct shadows... */
background-color: rgba(0, 0, 0, 0.18);
}
The solution doesn't need to take care of legacy browsers (< IE 10).
Thanks
Use This CSS
.tab.active {
box-shadow: 0 -5px 2.5px 2px rgba(0, 0, 0, 0.18);
position: relative;
z-index: 99999;
}
.tab {
background: #fff none repeat scroll 0 0;
display: inline-block;
height: 30px;
line-height: 30px;
text-align: center;
width: calc(50% - 2px);
}
.content {
box-shadow: 0 0 2.5px 2px rgba(0, 0, 0, 0.18);
margin-top: 0;
min-height: 50px;
position: relative;
z-index: 999;
}
Edit Your CSS
.box {
- Remove this-
/*box-shadow: 0 0 2.5px 2px rgba(0, 0, 0, 0.18); */
height: 250px;
margin: 16px;
width: 200px;
}