The header I've made keeps getting overlapped by the button that I placed in front of the image.
Before
After
I feel like this is happening due to the outer_header position: fixed but I cannot seem to find an alternative that will allow it to overlap the button. And I am not sure why it doesn't overlap the other content.
My assumption is that its because the button's position is absolute but I need that to be able to move to the button on top of the image.
.outer_header {
position: fixed;
width: 98%;
padding:20px;
top:0;
background-color: #e6c300;
}
.header {
background-color: #333;
position: sticky;
top:0;
}
.header * {
display: inline;
}
.active{
background-color: grey;
}
.Navigation a{
border-style: solid;
border-color:grey;
background-clip: padding-box;
background-color: grey;
display: inline-block;
color:white;
text-decoration: none;
text-align: center;
}
.Navigation a:hover {
background-color: #ddd;
color: black;
border-color:black;
}
#search_bar {
padding:6px;
margin-top: 8px;
font-size: 15px;
border: none;
}
.search-icon, .add_cart{
padding: 6px 10px;
margin-top: 8px;
margin-right: 16px;
background: #ddd;
font-size: 15px;
border: none;
cursor: pointer;
}
.add_cart {
background: black;
}
#banner {
width: 100%;
padding-top: 90px;
}
#Banner_btn {
position: absolute;
top: 70%;
left: 78.25%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: white;
color: black;
font-size: 25px;
padding: 24px 16px 24px 16px;
border: 2px solid grey;
cursor: pointer;
}
#Banner_btn:hover {
background-color: #bfbfbf;
}
You should add a z-index to your header
.header {
background-color: #333;
position: sticky;
top:0;
z-index: 10;
}
and if that doesn't work, also add a lower z-index to #Banner_btn, eg:
#Banner_btn { z-index: 5; }
Related
I have a button with a hover effect that fills the background from left to right:
Current HTML
Mehr erfahren
Current CSS
body {
background-color: #f6f6f6;
}
a {
text-decoration: none;
color: black;
}
a:hover {
text-decoration: none;
}
.button {
font-size: 20px;
color: black;
background-color: white;
padding: 20px;
border-radius: 50px;
display: inline-block;
background-image: radial-gradient(circle at left, black 50%, black 50%);
background-size: 0 100%;
background-repeat: no-repeat;
transition: 0.4s;
}
.button:hover {
color: white;
background-size: 100% 100% !important;
}
.button::before {
content: "";
display: inline-block;
width: 15px;
height: 15px;
-moz-border-radius: 7.5px;
-webkit-border-radius: 7.5px;
border-radius: 7.5px;
background-color: white;
border: 1px solid black;
margin-right: 15px;
}
Find it also here on codepen
Goal is that the right side of the fill color has rounded corners like here:
Any ideas? Thanks in advance
As mentioned in this other SO question, there is no way to add border-radius directly to the background-image. If you are open to another option to get your desired result using a pseudo background element and adding a <span> around your text for z-index adjustment, then you can reference my example below.
body {
background-color: #f6f6f6;
}
a {
text-decoration: none;
color: black;
}
a:hover,
a:focus {
text-decoration: none;
}
.button {
font-size: 20px;
color: black;
background-color: white;
padding: 20px;
border-radius: 50px;
display: inline-block;
transition: 0.4s;
}
.button:hover,
.button:focus {
color: white;
}
/* New CSS */
.button {
position: relative;
overflow: hidden;
-webkit-mask-image: -webkit-radial-gradient(white, black);
}
.button:hover::after,
.button:focus::after {
transform: translateX(0);
}
.button::after {
content: '';
position: absolute;
top: 0;
left: 0;
background: #000;
width: 100%;
height: 100%;
border-radius: 50px;
transform: translateX(-100%);
z-index: 0;
transition: 0.4s;
}
.button span {
position: relative;
z-index: 1;
}
.button span::before {
content: "";
display: inline-block;
width: 15px;
height: 15px;
-moz-border-radius: 7.5px;
-webkit-border-radius: 7.5px;
border-radius: 7.5px;
background-color: white;
border: 1px solid black;
margin-right: 15px;
}
<span>Mehr erfahren</span>
I'm having an issue customizing the CSS of some button widgets that came with a WordPress theme I'm running. I grabbed a quick screen capture video of what's happening because it's hard to describe.
Video Link: https://drive.google.com/open?id=1mYvOtAjz-0QnJYV3_nGYXnFoRpsRdVo_
The CSS I have applied on the buttons:
.lc_button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
.lc_button:hover {
background-color: white;
border: 4px solid #dd3333 !important;
color: #151515 !important;
}
.lc_button a:hover {
color: #151515 !important;
}
Any idea what I have to do to get the inside to stay visible no matter where the cusror is at inside the button?
Thanks
I've tried to solve your problem. I am successful. You can use this code of mine.
HTML
<div class="lc_button">
Watch video
</div>
CSS
.lc_button a {
display: block;
width: 200px;
height: 100px;
line-height: 100px;
font-size: 18px;
font-weight: 700;
color: #000000;
border-radius: 5%;
box-sizing: border-box;
transition: 0.3s;
background-color: white;
text-decoration: none;
text-transform: uppercase;
text-align: center;
position: relative;
}
.lc_button a:before {
display: block;
position: absolute;
border-radius: 5%;
left: 0;
top: 0;
content: "";
width: 200px;
height: 100px;
box-sizing: border-box;
border: 1px solid red;
transition: 0.3s;
}
.lc_button a:hover:before {
border: 4px solid red;
}
.lc_button a:hover {
color: #151515 !important;
background-color: #ffffff;
}
.lc_button a {
display: block;
width: 200px;
height: 100px;
line-height: 100px;
font-size: 18px;
font-weight: 700;
color: #000000;
border-radius: 5%;
box-sizing: border-box;
transition: 0.3s;
background-color: white;
text-decoration: none;
text-transform: uppercase;
text-align: center;
position: relative;
}
.lc_button a:before {
display: block;
position: absolute;
border-radius: 5%;
left: 0;
top: 0;
content: "";
width: 200px;
height: 100px;
box-sizing: border-box;
border: 1px solid red;
transition: 0.3s;
}
.lc_button a:hover:before {
border: 4px solid red;
}
.lc_button a:hover {
color: #151515 !important;
background-color: #ffffff;
}
<div class="lc_button">
Watch video
</div>
The .css you've provided seems fully functional, and customizable. (aka, not broken, works fine).
The whole .css and the .html might shed some light on things without any "major alterations".
.lc_button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
.lc_button:hover {
background-color: white;
border: 4px solid #0000ff !important;
color: #00ff00 !important;
}
.lc_button a:hover {
color: #151515 !important;
}
<body>
<button class="lc_button">Test</button>
</body>
I've shared the code snippet..I think this will help you to solve the problem...
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body{
font-family: 'PT Sans', sans-serif;
display: table;
width: 100%;
background: #f54785;
}
.container{
display: table-cell;
vertical-align: middle;
text-align: center;
height: 100vh;
}
button{
display: inline-block;
position: relative;
background: none;
border: none;
color: #fff;
font-size: 18px;
cursor: pointer;
margin: 20px 30px;
background: rgba(0,0,0,0.09);
}
span{
display: block;
padding: 25px 80px;
}
button::before, button::after{
content:"";
width: 0;
height: 2px;
position: absolute;
transition: all 0.2s linear;
background: #fff;
}
span::before, span::after{
content:"";
width:2px;
height:0;
position: absolute;
transition: all 0.2s linear;
background: #fff;
}
button:hover::before, button:hover::after{
width: 100%;
}
button:hover span::before, button:hover span::after{
height: 100%;
}
.btn-1::after{
left:0;
bottom: 0;
transition-duration: 0.4s;
}
.btn-1 span::after{
right:0;
top: 0;
transition-duration: 0.4s;
}
.btn-1::before{
right: 0;
top: 0;
transition-duration: 0.4s;
}
.btn-1 span::before{
left: 0;
bottom: 0;
transition-duration: 0.4s;
}
<div class="container">
<button class="btn-1"><span>Hover Me</span></button>
</div>
This will help you to solve the problem...
button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
button:hover {
background-color: white;
border: 4px solid #dd3333 !important;
color: #151515 !important;
}
button a:hover {
color: #151515 !important;
}
<div class="container">
<button class="lc_button"><span>Hover Me</span></button>
</div>
I'm trying to implement a popup at the bottom right corner of my web in WordPress.
The popup is working properly, but I have 2 lines of text, a message and a button. Everything was okay since I wanted to put a margin-top in the button because the button was covering the text.
Here you can see the HTML code and the CSS.
#corner-slider {
position: fixed;
z-index: 10000;
overflow: hidden;
border-radius: 15px;
color: white;
padding: 10px;
margin-bottom: 60px;
height: 120px;
width: 369px;
border: 1px solid #2d93f1;
background: #2d93f1;
}
#corner-slider.hidden {
display: none;
}
#corner-slider .close {
position: absolute;
cursor: pointer;
font-size: 16px;
display: inline-block;
z-index: 1002;
right: 24px;
top: 10px;
}
.popup-button {
padding: 8px 30px;
background-color: #ffffff;
border-color: #ffffff;
border-radius: 45px;
margin-top: 240px;
}
<div id="corner-slider">
Do you want to stay here?
<br />
<a target="_blank" href="#" class="popup-button">Click me!</a>
</div>
So, why is margin-top not working? What can I do?
Thanks.
The anchor element <a> is an inline element. Change its display type to inline-block or block:
#corner-slider {
position: fixed;
z-index: 10000;
overflow: hidden;
border-radius: 15px;
color: white;
padding: 10px;
margin-bottom: 60px;
height: 120px;
width: 369px;
border: 1px solid #2d93f1;
background: #2d93f1;
}
#corner-slider.hidden {
display: none;
}
#corner-slider .close {
position: absolute;
cursor: pointer;
font-size: 16px;
display: inline-block;
z-index: 1002;
right: 24px;
top: 10px;
}
.popup-button {
padding: 8px 30px;
background-color: #ffffff;
border-color: #ffffff;
border-radius: 45px;
display: inline-block;
margin-top: 1em;
}
<div id="corner-slider">
Do you want to stay here?
<br />
<a target="_blank" href="#" class="popup-button">Click me!</a>
</div>
button is not stable, just add disply:inline-block or float:left
#corner-slider {
position: fixed;
z-index: 10000;
overflow: hidden;
border-radius: 15px;
color: white;
padding: 10px;
margin-bottom: 60px;
height: 120px;
width: 369px;
border: 1px solid #2d93f1;
background: #2d93f1;
}
#corner-slider.hidden {
display: none;
}
#corner-slider .close {
position: absolute;
cursor: pointer;
font-size: 16px;
display: inline-block;
z-index: 1002;
right: 24px;
top: 10px;
}
.popup-button {
padding: 8px 30px;
background-color: #ffffff;
border-color: #ffffff;
border-radius: 45px;
margin-top: 10px;
display: inline-block; /* newly added */
}
<div id="corner-slider">
Do you want to stay here?
<br />
<a target="_blank" href="#" class="popup-button">Click me!</a>
</div>
i made some changes in your code just have a look in the below code, just place the text in the div and add a css of margin-bottom:15px;
<style>
#corner-slider {
position:fixed;
z-index:10000;
overflow:hidden;
border-radius: 15px;
color: white;
padding: 10px;
margin-bottom: 60px;
height: 120px;
width:369px;
border:1px solid #2d93f1;
background:#2d93f1;
}
#corner-slider.hidden{
display:none;
}
#corner-slider .close{
position:absolute;
cursor:pointer;
font-size:16px;
display:inline-block;
z-index:1002;
right:24px;
top:10px;
}
.popup-button {
padding: 8px 30px;
background-color: #ffffff;
border-color: #ffffff;
border-radius: 45px;
margin-top: 240px;
}
/*--------------- new css ----------*/
.small-area
{
margin-bottom: 15px;
}
</style>
<div id="corner-slider">
<div class="small-area">Do you want to stay here?</div>
<a target="_blank" href="#" class="popup-button">Click me!</a>
</div>
I got a mockup that I want to realize.
I have something that is almost good, but the corners of the buttons and the corners of the fields are not round enough:
Is it possible to apply the small rounding that is in the mockup? I got a fiddle with my result so far.
http://jsfiddle.net/niklasro/d4D8z/
body {
font-family:'Raleway', sans-serif;
}
#element1 {display:inline-block;margin-left:10px; }
.textInput{padding-left:5px}
#header {
width: 100%;
position: fixed;
height: 45px;
border-bottom: solid 2px #0072c9;
background-color: #FFFFFF;
z-index: 30;display:inline-block;
}
#header-title {
left: 250px;
font-size: 22px;
bottom: 7px;
color: #0072c9;
font-weight: 400;
position: absolute;
}
.title {
font-weight: normal;
font-size: 23px;
color: rgb(0, 114, 198);
line-height: 1.429;
z-index: 70;
}
#navigation-bar {
width: 230px;
height: 100%;
box-shadow: 0 0 8px 6px rgba(0, 0, 0, 0.2);
z-index: 20;
position: absolute;
}
#navigation-content {
width: 100%;
height: auto;
position: absolute;
top: 47px;
}
.navigation-button {
position: relative;
width: 100%;
height: 80px;
margin: 15px 0px;
}
.navigation-header {
position: absolute;
top: 15px;
left: 10px;
color: #0072c9;
font-size: 25px;
}
.navigation-desc {
position: absolute;
bottom: 15px;
left: 10px;
font-size: 12px;
color: #0072c9;
}
.login form {
width: 445px;
overflow: hidden;
}
.login label {
padding: 2px;
display: block;
line-height: 22px;
background: #ebebeb;
font-size: 13px;
margin-top: 10px;
overflow: hidden;
}
.login label span {
display: inline-block;
padding-left: 10px;
}
.login label input {
display: inline-block;
width: 270px;
height: 20px;
float: right;
border: none;
outline: none;
}
.login .buttons {
margin-top: 7px;
float: right;
}
.login .buttons button {
display: inline-block;
height: 33px;
line-height:30px;
background: rgb(0, 114, 198);
color: white;
font-size: 17px;
border: none;
}
#upload-file {
display:none;
}
#upload{
display:none;
}
#logga {
border-top: solid 2px #0072c9;
}
#logout {
border-top: solid 2px #0072c9;
}
#navigation-content a:hover div.navigation-button {
background:lightgrey;
}
#navigation-content a:hover div.navigation-button:before {
content:' ';
display:block;
position:absolute;
right:-20px;
top:15px;
height:30px;
width:30px;
background:white;
-webkit-transform-origin: 5px 25px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
table{ width:100%;
border-collapse:collapse;
text-align:center;
border:1px solid #00F;
font-size:12px;}
th{background:#EEE;width:auto; text-align:center; padding:5px 0;border:1px solid #00F;}
td{width:auto; text-align:center; padding:5px 0;border:1px solid #00F;}
tr:nth-child(even) {background: #EEE;}
Give border-radius to you labels and buttons:
.login label {
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.login .buttons button {
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
Updated Fiddle
border-radius is used for rounded corners.
Write:
.login label{border-radius:5px;}
.login .buttons button{border-radius:3px;}
Updated fiddle here.
More information here.
Use the border-radius css property
border-radius: 2px;
See: http://www.w3schools.com/cssref/css3_pr_border-radius.asp
Use border-radius property to get rounded corners.
.login label input {
border-radius: 15px;
}
same can be applied to class .login label as well.
.login .buttons button {
border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
}
.login label {border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
}
Try this.
Hello I'm just wondering how will I be able to achieve a chatbox with a fixed header & reply textbox. So far this is what I have.
.headerchat{
background-color: #336699;
width: 100%;
padding-top: 3px;
padding-bottom: 3px;
font-weight: bold;
color: #fff;
display: block;
}
.buddies {
background-color: #fff;
border: 1px solid #ccc;
bottom: 30px;
display: none;
font-size: 12px;
left: 205px;
position: fixed;
width: 235px;
height: 200px;
margin: 0;
padding: 0;
overflow-x: hidden;
overflow-y: auto;
}
.messages {
background-color: #fff;
border: 1px solid #ccc;
bottom: 30px ;
font-size: 12px;
display: none;
left: 205px;
position: fixed;
width: 235px;
height: 400px;
margin: 0;
padding: 0;
overflow: scroll;
z-index: 100;
}
.gray{
color:#aaa;
}
.chat{
word-wrap:break-word;
width: 235px;
}
.username{
text-decoration: none;
color: #336699;
text-transform: capitalize;
}
.username:hover{
text-decoration: none;
color: #6699aa;
}
.conversation{
width:235px;
padding: 0;
border-bottom: 1px dotted #999;
float: left;
}
/*.conversationpicture{
float:left;
}*/
.closecontainer{
float: right;
}
.close, .close:hover{
text-decoration: none;
font-weight: bolder;
color: #fff;
}
.buddycontainer
{
float:left;
}
.formchattext
{
display: block;
font-size:12px;
border:1px solid #ccc;
width:234px;
padding: 0;
margin: 0;
height: 30px;
position: fixed;
bottom: 30px;
}
http://jsfiddle.net/ENydt/
What I want to achieve is to have a fixed header, scrollable content and fixed reply textfield.
I tried overflow-x: scroll; to both .buddies & .messages still no luck I am kind still newbie with this so I am really sorry. If you could just have a quick look at it. Thanks.
I modified Your code, this is
SAMPLE CODE:
.antiscroll-inner {
height: 300px;
overflow-y:scroll;
}
DEMO:
http://jsfiddle.net/ENydt/13/
In future coding try to avoid write inline style for html elements