Linear gradient is not working with <a> element [duplicate] - html

This question already has answers here:
What are valid values for the id attribute in HTML?
(26 answers)
Closed 4 years ago.
I am trying to apply CSS gradients to my <a> elements. It clearly doesn't work and I've been trying to work it out with no success. I am using Chrome if it has to do anything with the issue.
body {
margin: 1cm;
}
a {
padding: 15px 60px 15px 60px;
text-decoration: none;
border: 1px solid black;
}
#1button {
background: rgb(2, 0, 36);
background: linear-gradient(65deg, rgba(2, 0, 36, 1) 0%, rgba(12, 12, 125, 1) 35%, rgba(0, 212, 255, 1) 100%);
}
#2button {
background: rgb(2, 0, 36);
background: linear-gradient(65deg, rgba(2, 0, 36, 1) 0%, rgba(232, 51, 55, 1) 35%, rgba(241, 95, 223, 1) 100%);
}
<a id="1button">Button #1</a>
<a id="2button">Button #2</a>

Don't use a number as the 1st character of your ids:
body {
margin: 1cm;
}
a {
padding: 15px 60px 15px 60px;
text-decoration: none;
border: 1px solid black;
}
#button1 {
background: linear-gradient(65deg, rgba(2, 0, 36, 1) 0%, rgba(12, 12, 125, 1) 35%, rgba(0, 212, 255, 1) 100%);
}
#button2 {
background: linear-gradient(65deg, rgba(2, 0, 36, 1) 0%, rgba(232, 51, 55, 1) 35%, rgba(241, 95, 223, 1) 100%);
}
<a id="button1">Button #1</a>
<a id="button2">Button #2</a>

Related

How to make footer elements be same width with CSS

I have a footer for my project which has two images... each one of them is stuck to a particular corner. The lower left corner is the Division logo (system_footer_left); while the lower right corner is the Brand Logo (system_footer_right). What I would like to do is to have the size of the section to be the same as the width, even if the widths of the images are not the same.
How can I make this happen?
In my current project design, the left logo is about half the width of the right logo.
I am rusty with CSS, I have not been able to find any answers online. I did not want to set the width as a fixed percentage as I would like to have it be dynamic, so that if we change brand assets (logos) it will just "plug and play".
#system_footer {
padding: 5 5 0 5;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: rgba(5, 51, 107, .75);
text-align: center;
margin: auto;
}
#system_footer_center {
padding: 10px;
bottom: 0;
background-color: transparent;
color: #FFD700;
text-align: center;
font-size: 12px;
font-weight: 500;
margin: auto;
word-wrap: break-word;
text-shadow: 2px 2px 2px #FF8C00;
}
#system_footer_right {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: right;
max-width: 30%;
text-align: right;
border: 3px outset rgba(208, 207, 204, .5);
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#system_footer_right:hover {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: right;
max-width: 30%;
text-align: right;
border: 4px outset rgba(231, 231, 229, 1);
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#system_footer_left {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: left;
max-width: 30%;
text-align: left;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
border: 3px outset rgba(208, 207, 204, .5);
-webkit-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#system_footer_left:hover {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: left;
max-width: 30%;
text-align: left;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
border: 4px outset rgba(231, 231, 229, 1);
-webkit-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
.cny-logo-sm {
width: auto;
max-height: 35px;
object-fit: scale-down;
}
#media screen and (min-width: 300px) {
#system_footer_center {
font-size: calc(12px + (16 - 12) * ((100vw - 300px) / (1000 - 300)));
}
}
/* WITHOUT THE BLOCK BELOW, THE FONT WOULD CONTINUE TO GROW */
#media screen and (min-width: 1000px) {
#system_footer_center {
font-size: 16px;
}
}
<div id='system_footer'>
<div id='system_footer_left'>
<img src='../resources/logo/b_white_trans.png' alt='(Decorative) ' class='cny-logo-sm'>
</div>
<div id='system_footer_right'>
<img src='.../resources/logo/cny.png' alt='CNY (Logo)' class='cny-logo-sm'>
</div>
<div id='system_footer_center'>
<p>For technical support, please contact XXXX at <a href='mailto:DONTEMAIL#MY.BRAND.COM?subject=MCR System'>XXX#XXXX.XXX</a></p>
</div>
</div>
I am trying to get the left and right footer element frames to be the same width dynamically.
You can try something like this. You can't by CSS set the same width for 2 elements based on their content, you can set the width in percent or in other relative units for both containers and align content inside. I have updated hover effects and sizes because it looks bad when content jumps. I remove duplicated CSS, you have same styles on the left and the right blocks. Images keep aspect ratio, updated styles. Sorry for my bad English.
.cny-logo-sm {
display: block;
margin: auto;
width: auto;
max-width: 100%;
max-height: 35px;
object-fit: contain;
}
#system_footer {
box-sizing: border-box;
display: flex;
justify-content: space-between;
padding: 5px 5px 0;
position: fixed;
left: 0;
bottom: 0;
right: 0;
width: 100%;
background-color: rgba(5, 51, 107, .75);
text-align: center;
margin: auto;
}
#system_footer_center {
flex: 1 0 auto;
padding: 10px;
bottom: 0;
background-color: transparent;
color: #FFD700;
text-align: center;
font-size: 12px;
font-weight: 500;
margin: auto;
word-wrap: break-word;
text-shadow: 2px 2px 2px #FF8C00;
}
#system_footer_right {
order: 3;
}
#system_footer_left,
#system_footer_right {
display: inline-block;
flex: 1 1 30%;
/*max-width: 30%;*/
box-sizing: border-box;
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 15px;
text-align: right;
border: 3px outset rgba(208, 207, 204, .5);
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#system_footer_left:hover,
#system_footer_right:hover {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
max-width: 30%;
border: 4px outset rgba(231, 231, 229, 1);
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#media screen and (min-width: 300px) {
#system_footer_center {
font-size: calc(12px + (16 - 12) * ((100vw - 300px) / (1000 - 300)));
}
}
/* WITHOUT THE BLOCK BELOW, THE FONT WOULD CONTINUE TO GROW */
#media screen and (min-width: 1000px) {
#system_footer_center {
font-size: 16px;
}
}
<div id='system_footer'>
<div id='system_footer_left'>
<img src='https://via.placeholder.com/150x30' alt='(Decorative) ' class='cny-logo-sm'>
</div>
<div id='system_footer_right'>
<img src='https://via.placeholder.com/270x270' alt='CNY (Logo)' class='cny-logo-sm'>
</div>
<div id='system_footer_center'>
<p>For technical support, please contact XXXX at <a href='mailto:DONTEMAIL#MY.BRAND.COM?subject=MCR System'>XXX#XXXX.XXX</a></p>
</div>
</div>
I am still not sure I understand you request but I think that this is what you are needing
#system_footer_left img,
#system_footer_right img{
width:100%;
}
#system_footer {
padding: 5 5 0 5;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: rgba(5, 51, 107, .75);
text-align: center;
margin: auto;
}
#system_footer_center {
padding: 10px;
bottom: 0;
background-color: transparent;
color: #FFD700;
text-align: center;
font-size: 12px;
font-weight: 500;
margin: auto;
word-wrap: break-word;
text-shadow: 2px 2px 2px #FF8C00;
}
#system_footer_right {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: right;
max-width: 30%;
text-align: right;
border: 3px outset rgba(208, 207, 204, .5);
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#system_footer_right:hover {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: right;
max-width: 30%;
text-align: right;
border: 4px outset rgba(231, 231, 229, 1);
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: -1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#system_footer_left {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: left;
max-width: 30%;
text-align: left;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
border: 3px outset rgba(208, 207, 204, .5);
-webkit-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
#system_footer_left img,
#system_footer_right img{
width:100%;
}
#system_footer_left:hover {
background: rgb(170, 213, 255);
background: -webkit-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: -o-linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
background: linear-gradient(rgba(170, 213, 255, 0.5) 8%, rgba(5, 51, 107, 1) 29%, rgba(5, 51, 107, 0.6362920168067228) 67%, rgba(170, 213, 255, 1) 100%, rgba(5, 51, 107, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#aad5ff", endColorstr="#05336b", GradientType=1);
padding: 14px;
float: left;
max-width: 30%;
text-align: left;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
border: 4px outset rgba(231, 231, 229, 1);
-webkit-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
-moz-box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
box-shadow: 1px -0px 1px 1px rgba(255, 255, 255, 0.75);
}
.cny-logo-sm {
width: auto;
max-height: 35px;
object-fit: scale-down;
}
#media screen and (min-width: 300px) {
#system_footer_center {
font-size: calc(12px + (16 - 12) * ((100vw - 300px) / (1000 - 300)));
}
}
/* WITHOUT THE BLOCK BELOW, THE FONT WOULD CONTINUE TO GROW */
#media screen and (min-width: 1000px) {
#system_footer_center {
font-size: 16px;
}
}
<div id='system_footer'>
<div id='system_footer_left'>
<img src='https://via.placeholder.com/500x60?text=Decorative' alt='(Decorative) ' class='cny-logo-sm'>
</div>
<div id='system_footer_right'>
<img src='https://via.placeholder.com/250?text=logo' alt='CNY (Logo)' class='cny-logo-sm'>
</div>
<div id='system_footer_center'>
<p>For technical support, please contact XXXX at <a href='mailto:DONTEMAIL#MY.BRAND.COM?subject=MCR System'>XXX#XXXX.XXX</a></p>
</div>
</div>
If I understand what you're asking, you could use grid:
https://codepen.io/cschloegel/pen/wVzKZo
<div class="grid-container">
<div class="header"></div>
<div class="content"></div>
<div class="footer">
<div class="footer-left"></div>
<div class="footer-center"></div>
<div class="footer-right"></div>
</div>
</div>
CSS:
.grid-container {
background-color:lightgrey;
height:100vh;
display: grid;
grid-template-columns: 1fr 6fr 1fr;
grid-template-rows: 100px 1fr 100px;
grid-template-areas: "header header header" "content content content" "footer footer footer";
}
.header {
grid-area: header;
background-color: grey;
}
.content { grid-area: content; }
.footer {
display: grid;
grid-template-columns: 1fr 6fr 1fr;
grid-template-rows: 1fr;
grid-template-areas: "footer-left footer-center footer-right";
grid-area: footer;
background-color:grey;
}
.footer-left {
grid-area: footer-left;
border: 4px solid black;
background-color:darkgrey;
}
.footer-center { grid-area: footer-center; }
.footer-right { grid-area: footer-right;
border: 4px solid black;
background-color:darkgrey;
}

Overflow wrap not being applied to text

Issue
I currently have a side menu that I have built using Angular and it works pretty well on my screen (4k resolution). Problem being on smaller screens the text in the menu doesn't wrap so it overflows the container div. I have tried applying overflow-wrap: break-word; to the text but that is not working.
Any assistance would be greatly appreciated.
You can see the issue below:
Code
HTML of the component:
<div class="sidebar animated fadeIn">
<div class="header">
<div style="display:block;margin-left:auto;margin-right:auto;width:100%;">
<img src="../../../assets/images/logo.svg" style="width:100%" />
</div>
</div>
<div class="spacer"></div>
<div class="menu-item" *ngFor="let item of items" (click)="goTo(item.path)">
<i class="material-icons">{{item.icon}}</i>
<h3 class="text">{{item.name}}</h3>
</div>
</div>
Styling of the component:
.sidebar {
position: absolute;
top: 0;
bottom: 0;
left: 0;
z-index: 2;
width: 10%;
background: rgba(191, 158, 69, 1);
background: -moz-linear-gradient(top, rgba(191, 158, 69, 1) 0%, rgba(250, 239, 210, 1) 100%);
background: -webkit-gradient(
left top,
left bottom,
color-stop(0%, rgba(191, 158, 69, 1)),
color-stop(100%, rgba(250, 239, 210, 1))
);
background: -webkit-linear-gradient(bottom, rgba(191, 158, 69, 1) 0%, rgba(250, 239, 210, 1) 100%);
background: -o-linear-gradient(bottom, rgba(191, 158, 69, 1) 0%, rgba(250, 239, 210, 1) 100%);
background: -ms-linear-gradient(bottom, rgba(191, 158, 69, 1) 0%, rgba(250, 239, 210, 1) 100%);
background: linear-gradient(to top, rgba(191, 158, 69, 1) 0%, rgba(250, 239, 210, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bf9e45', endColorstr='#faefd2', GradientType=0 );
box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
}
.header {
width: 100%;
}
.spacer {
margin-top: 3em;
}
.menu-item {
border-top: 1px solid darkgray;
padding-left: 2em;
height: 3em;
display: flex;
align-items: center;
cursor: pointer;
}
.menu-item .text {
margin-left: auto;
margin-right: auto;
overflow-wrap: break-word;
}
Add this property word-break: break-all;
.menu-item .text {
margin-left: auto;
margin-right: auto;
/*overflow-wrap: break-word;*/
word-break: break-all;
}

How to adjust the color with rgb value?

I have created login form using html5 and css3.
Here is my html5 code for login form:
<section id="content">
<form action="">
<h1>Login Form</h1>
<div>
<input type="text" placeholder="Username" required="" id="username" />
</div>
<div>
<input type="password" placeholder="Password" required="" id="password" />
</div>
<div>
<input type="submit" value="Log in" />
</div>
</form><!-- form -->
</section><!-- content -->
Here is my jsfiddle: http://jsfiddle.net/q4bvL9mw/1/
I want to change the login button as black and hover state will be silver color.
May i know where is the exact place can i adjust the color properties.
Can anyone help me? thanks in advance.
You should be change the color properties in your css.
#content form input[type="submit"] { background: rgba(0,0,0,1); }
#content form input[type="submit"]:hover { background: rgba(204,204,204,1); }
Its works for me. See in the action JS Fiddle
For border and shadow effects buttons modify only last parameter rgba, the value is the Alpha Channel.
[Edited]
Try this:
Demo on Fiddle
CSS:
#content form input[type="submit"] {
background: rgb(254, 231, 154);
background: -moz-linear-gradient(top, rgba(0, 0, 0, 1) 0%, rgba(126, 126, 126, 1) 100%);
background: -webkit-linear-gradient(top, rgba(0, 0, 0, 1) 0%, rgba(126, 126, 126, 1) 100%);
background: -o-linear-gradient(top, rgba(0, 0, 0, 1) 0%, rgba(126, 126, 126, 1) 100%);
background: -ms-linear-gradient(top, rgba(0, 0, 0, 1) 0%, rgba(126, 126, 126, 1) 100%);
background: linear-gradient(top, rgba(0, 0, 0, 1) 0%, rgba(126, 126, 126, 1) 100%);
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
-ms-border-radius: 30px;
-o-border-radius: 30px;
border-radius: 30px;
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8) inset;
-moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8) inset;
-ms-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8) inset;
-o-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8) inset;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8) inset;
border: 1px solid rgb(0, 0, 0);
color: #000;
cursor: pointer;
font: bold 15px Helvetica, Arial, sans-serif;
height: 35px;
margin: 20px 0 35px 15px;
position: relative;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
width: 120px;
}
#content form input[type="submit"]:hover {
background: -moz-linear-gradient(top, rgba(126, 126, 126, 1) 0%, rgba(0, 0, 0, 1) 100%);
background: -webkit-linear-gradient(top, rgba(126, 126, 126, 1) 0%, rgba(0, 0, 0, 1) 100%);
background: -o-linear-gradient(top, rgba(126, 126, 126, 1) 0%, rgba(0, 0, 0, 1) 100%);
background: -ms-linear-gradient(top, rgba(126, 126, 126, 1) 0%, rgba(0, 0, 0, 1) 100%);
background: linear-gradient(top, rgba(126, 126, 126, 1) 0%, rgba(0, 0, 0, 1) 100%);
}

Align text vertically and horizontally in CSS button

I have a that has been styled in CSS to look like a button. The problem I'm having though is that the button MUST be 185px wide and 75px high. Which I get right, but the text of the button is floating somewhere on top to the left.
How do I get the text to display exactly in the middle of the button? I've created a JSfiddle so you guys can check it out.
//Ignore this comment.
Change height to line-height and add text-align:center
.button-large{
text-decoration: none;
display: inline-block;
text-align:center;
width: 185px;
line-height: 75px;
font-family: sans-serif;
color: rgb(116, 79, 145);
font-size: 24px;
padding: 10px;
text-shadow: 0px -1px 0px rgba(30, 30, 30, 0.6);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background: rgb(156, 125, 185);
background: -moz-linear-gradient(90deg, rgb(156, 125, 185) 30%, rgb(170, 150, 201) 70%);
background: -webkit-linear-gradient(90deg, rgb(156, 125, 185) 30%, rgb(170, 150, 201) 70%);
background: -o-linear-gradient(90deg, rgb(156, 125, 185) 30%, rgb(170, 150, 201) 70%);
background: -ms-linear-gradient(90deg, rgb(156, 125, 185) 30%, rgb(170, 150, 201) 70%);
background: linear-gradient(0deg, rgb(156, 125, 185) 30%, rgb(170, 150, 201) 70%);
-webkit-box-shadow: 0px 2px 1px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 2px 1px rgba(0, 0, 0, 0.4);
box-shadow: 0px 2px 1px rgba(0, 0, 0, 0.4);
}
DEMO

Tooltip/Speech bubble with a gradient background and arrow at top-center

I have this shape:
and I was wondering if its possible to create it with CSS3.
This is what I have so far (click for fiddle):
HTML:
<div id="cafeDialog" role="dialog" class="cafeDialog caspSearch" style="">
<div data-title="Search" role="main">
<div>
</div>
</div>
</div>
CSS:
html, body {
height: 100%;
}
.caspSearch {
border: 1px solid black;
background: black;
background: -moz-linear-gradient(top, rgba(128, 144, 152, 0.9) 0%, rgba(67, 74, 80, 0.91) 8%, rgba(54, 58, 61, 0.96) 91%, rgba(74, 81, 85, 0.9) 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(128, 144, 152, 0.9)), color-stop(8%, rgba(67, 74, 80, 0.91)), color-stop(91%, rgba(54, 58, 61, 0.96)), color-stop(100%, rgba(74, 81, 85, 0.9)));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(128, 144, 152, 0.9) 0%, rgba(67, 74, 80, 0.91) 8%, rgba(54, 58, 61, 0.96) 91%, rgba(74, 81, 85, 0.9) 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(128, 144, 152, 0.9) 0%, rgba(67, 74, 80, 0.91) 8%, rgba(54, 58, 61, 0.96) 91%, rgba(74, 81, 85, 0.9) 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(128, 144, 152, 0.9) 0%, rgba(67, 74, 80, 0.91) 8%, rgba(54, 58, 61, 0.96) 91%, rgba(74, 81, 85, 0.9) 100%);
/* IE10+ */
background: linear-gradient(to bottom, rgba(128, 144, 152, 0.9) 0%, rgba(67, 74, 80, 0.91) 8%, rgba(54, 58, 61, 0.96) 91%, rgba(74, 81, 85, 0.9) 100%);
/* W3C */
width: 500px;
height: 300px;
border-radius: 10px;
padding: 0 !important;
position:relative;
top: 30px;
}
.caspSearch:before {
content:'';
width: 0;
height: 0;
display: block;
position: absolute;
border-bottom: 50px solid white;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
}
I'm struggling with the triangle since it needs to be with transparent gradient and the black border needs to wrap it .
Is this what you are looking for?
CSS
.triangle-isosceles {
height: 200px;
width: 300px;
position:relative;
padding:15px;
margin:1em 0 3em;
color:#000;
background:#f3961c;
background:-webkit-gradient(linear, 0 0, 0 100%, from(#f9d835), to(#f3961c));
background:-moz-linear-gradient(#f9d835, #f3961c);
background:-o-linear-gradient(#f9d835, #f3961c);
background:linear-gradient(#f9d835, #f3961c);
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
}
.triangle-isosceles.top {
background:-webkit-gradient(linear, 0 0, 0 100%, from(#f3961c), to(#f9d835));
background:-moz-linear-gradient(#f3961c, #f9d835);
background:-o-linear-gradient(#f3961c, #f9d835);
background:linear-gradient(#f3961c, #f9d835);
}
.triangle-isosceles:after {
content:"";
position:absolute;
bottom:-15px;
left:50px;
border-width:15px 15px 0;
border-style:solid;
border-color:#f3961c transparent;
display:block;
width:0;
}
.triangle-isosceles.top:after {
top:-15px;
right:50px;
bottom:auto;
left:auto;
border-width:0 15px 15px;
border-color:#f3961c transparent;
}
HTML
<p class="triangle-isosceles top">Your content.</p>
The Fiddle
http://jsfiddle.net/sjccN/4/
I made a sample for you... just add your shadows and such to this and your set :)
http://jsfiddle.net/BNgTh/
#talkbubble {
width: 120px;
height: 80px;
margin-top:20px;
margin-left:40px;
background: red;
position: relative;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#talkbubble:before {
content:"";
position: absolute;
top: -20px;
left:40%;
width: 0;
height: 0;
border-bottom: 26px solid red;
border-right: 13px solid transparent;
border-left: 13px solid transparent;
}
Change the top value in #talkbubble:before to make it smaller as you wish too.