Related
I want this
on a submit button so I gave it as a background.
I'm doing the page responsive so I gave it the next css :
#button1{
background: url('../images/button1.png') no-repeat;
margin-top:-270px;
padding-bottom: 10px;
padding-right: 2%;
width: 25%;
position:relative;
right:2.5%;
}
but when the page get smaller the image get cut.
How can I solve this problem?
If you have or can get/crop out the arrow and the barcode separately as transparent PNGs or GIFs, you can do this:
#button1 {
background: rgba(204,204,204,1);/* Old Browsers */
background: -moz-linear-gradient(top, rgba(204,204,204,1) 0%, rgba(102,102,102,1) 100%); /* FF3.6+ */
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(204,204,204,1)), color-stop(100%, rgba(102,102,102,1)));/* Chrome, Safari4+ */
background: -webkit-linear-gradient(top, rgba(204,204,204,1) 0%, rgba(102,102,102,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(204,204,204,1) 0%, rgba(102,102,102,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(204,204,204,1) 0%, rgba(102,102,102,1) 100%); /* IE 10+ */
background: linear-gradient(to bottom, rgba(204,204,204,1) 0%, rgba(102,102,102,1) 100%);/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#666666', GradientType=0 );/* IE6-9 */
position: relative;
border: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
#button1:after,
#button1:before {
display: inline-block;
content: url('img/button-barcode.png');
margin: .5em;
vertical-align: middle;
}
#button1:before {
content: url('img/button-arrow.png');
}
The code employs pseudo elements ::before and ::after to put the arrow and the barcode into the <button> and the button will be responsive that way.
P.S. Works only on <button> tags, not on the button type of <input>!
I'm having problems with a gradient in IE, it is not being displayed as I hoped it would.
I have created a grey gradient button which becomes slightly darker as you hover over it. There are no problems with the way it's displayed in firefox or chrome, it seems to only be an internet explorer problem.
html:
<input type="submit" value="Search" class="button1">
css:
.button1{
height:26px; font-family:verdana,arial, helvetica, sans-serif; font-size:12px; font-weight:bold;
cursor:pointer;
padding-left:10px; padding-right:10px; margin:2px;
border:1px solid #000; float:left;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color:#CCC;
background: rgb(254,255,232); /* Old browsers */
background: -moz-linear-gradient(top, rgba(254,255,232,1) 0%, rgba(214,219,191,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,232,1)),
color-stop(100%,rgba(214,219,191,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffe8', endColorstr='#d6dbbf',GradientType=0 ); /* IE6-9 */
}
.button1:hover{
background: -webkit-gradient(linear, left top, left bottom, from(#E6E6E6), to(#fff));/*for webkit*/
background: -moz-linear-gradient(top, #E6E6E6, #fff);/*for firefox*/
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#E6E6E6', endColorstr='#fff',GradientType=0);/*for IE*/
}
jsFiddle:
http://jsfiddle.net/Wg65Y/
IE support for CSS is a nightmare for developers and perhaps worst in case of gradients.
What you need is CSS3 solutions for Internet Explorer
I have a table with some CSS to style the table with rounded corners and a gradient background in the first row (for column headings) but come of the gradient is overflowing outside the rounded corner despite me specifying overflow: hidden;
HTML:
<table id="tblIncidentQueue" class="DataTable">
<tr class="TableHeaderFooter">
<td colspan="5">
<strong>Show </strong>
<asp:DropDownList ID="drpNumOfResults" runat="server">
<asp:ListItem Text = "10" Value="10" ></asp:ListItem>
<asp:ListItem Text = "20" Value="20" ></asp:ListItem>
<asp:ListItem Text = "50" Value="50" ></asp:ListItem>
<asp:ListItem Text = "100" Value="100" ></asp:ListItem>
<asp:ListItem Text = "All" Value="All" ></asp:ListItem>
</asp:DropDownList>
<strong> entries</strong>
</td>
<td align="right">
<img src="../images/Icons/Refresh.png" border="0" />
<img src="../images/Icons/Down.png" border="0" />
</td>
</tr>
</table>
CSS:
.DataTable
{
margin: 10px;
-moz-border-radius : 10px; /* Firefox */
-webkit-border-radius : 10px; /* Safari & Chrome */
-khtml-border-radius : 10px; /* Linux browsers */
border-radius : 10px; /* CSS3 compatible browsers */
border-style: solid;
border-width: 1px;
border-color: #cccccc;
padding: 0px;
border-spacing: 0px;
overflow: hidden;
}
.TableHeaderFooter
{
background: #eeeeee; /* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
overflow: hidden;
}
Any help greatly appreciated!
You have to set property border-radius for those td elements in TableHeaderFooter.
.TableHeaderFooter td:first-child {
border-radius : 10px 0px 0px 10px; /* rounds the top and bottom left corner */
}
.TableHeaderFooter td:last-child {
border-radius : 0px 10px 10px 0px; /* rounds the top and bottom right corner */
}
Now you shouldn't see any overflowing backgrounds e.g. gradients (note that overflow property is useless in this case)
I hope it helps
Put all your background code from .TableHeaderFooter into .DataTable.
The edges will disappear.
.DataTable {
margin: 10px;
-moz-border-radius : 10px; /* Firefox */
-webkit-border-radius : 10px; /* Safari & Chrome */
-khtml-border-radius : 10px; /* Linux browsers */
border-radius : 10px; /* CSS3 compatible browsers */
border-style: solid;
border-width: 1px;
border-color: #cccccc;
padding: 0px;
border-spacing: 0px;
overflow: hidden;
background: #eeeeee; /* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
}
.TableHeaderFooter {
}
I'm trying to make a navbar with a gradient and top and bottom borders. Trying it on different browsers results in slightly different sizes which break the layout by 1px. Is there a better way to do this?
Here's the HTML:
<head>
<!--[if gte IE 9]>
<style type="text/css">
.gradient {
filter: none;
}
</style>
<![endif]-->
</head>
<body>
<header>
<h1>Page Title</h1>
</header>
<div id="navbar" class="gradient">
<ul>
<li> Link 1 </li>
<li> Link 2 </li>
<li> Link 3 </li>
<li> Link 4 </li>
<li> Link 5 </li>
<li> Link 6 </li>
<li> Link 7 </li>
</ul>
</div>
</body>
And the CSS:
html, button, input, select, textarea {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
color: #222;
}
body {
margin: 0;
font-size: 1em;
line-height: 1.4;
}
header {
background-color: #fcfcfc;
}
h1 {
padding: 10px;
width: 968px;
margin: auto;
font-family: "Times", "Times New Roman", "serif";
font-style: italic;
}
#navbar {
padding: 0;
margin: 0;
border-bottom: 1px solid #999;
border-top: 1px solid #999;
background-color: #fff;
height: 31px;
font-size: 14px;
-webkit-text-size-adjust: 14px;
-ms-text-size-adjust: 14px;
background: #ffffff; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQ3JSIgc3RvcC1jb2xvcj0iI2Y2ZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZGVkZWQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-8 */
}
ul {
margin: 0 auto;
padding: 0;
width: 968px;
list-style-type: none;
}
li {
/* width: 138px;*/
display: inline;
padding: 6px 0;
float: left;
background: #ffffff; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQ3JSIgc3RvcC1jb2xvcj0iI2Y2ZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZGVkZWQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-8 */
}
li:hover {
background: #ededed; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VkZWRlZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUzJSIgc3RvcC1jb2xvcj0iI2Y2ZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #ededed 0%, #f6f6f6 53%, #ffffff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(53%,#f6f6f6), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ededed 0%,#f6f6f6 53%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ededed 0%,#f6f6f6 53%,#ffffff 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ededed 0%,#f6f6f6 53%,#ffffff 100%); /* IE10+ */
background: linear-gradient(to bottom, #ededed 0%,#f6f6f6 53%,#ffffff 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#ffffff',GradientType=0 ); /* IE6-8 */
}
li a {
color: #000;
text-decoration: none;
padding: 6px 32px;
}
To be completely honest, welcome to the wonderful world of Web Development. I would suggest creating a separate CSS file for each browser (Or at least IE), that way you can tweak the CSS to conform to your vision.
Get your Navbar looking good in say, Firefox/Chrome, then move on to tweaking a separate style-sheet for use with IE.
For example:
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ieisterrible.css" />
<![endif]-->
You have to understand that CSS 3 gradients won't behave equally in different browsers. You may generate a gradient using Ultimate CSS Gradient Generator which generates gradient for cross browser support. Even then, you can notice some color and behavior changes according to browser. In this case, I strongly recommend you to;
Make a nav-bar like rectangle in some image editor like Photoshop.
After applying the gradient, you may re-size the width to 1 px (height is not a problem)
You may then apply this image to your navbar using CSS like
background: #color_code gradient_image repeat-x
Since the image is just 1px wide, the size will be less and will load comparatively faster.
I am using simple pseudo-selector css functionlity. When I hover over my table-cells, they change background color, simple. But when the original background color of the table cells are of linear gradient, the td:hover does not work anymore. Here is my code:
CSS:
#rightDiv td{
font-size: 18px;
color: #ffffff;
padding: 10px 5px;
/*background: rgba(0,0,0,0.7);*/
background: -moz-linear-gradient(top, rgba(55,160,252,1) 0%, rgba(8,126,216,1) 46%, rgba(28,97,175,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(55,160,252,1)), color-stop(46%,rgba(8,126,216,1)), color-stop(100%,rgba(28,97,175,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(55,160,252,1) 0%,rgba(8,126,216,1) 46%,rgba(28,97,175,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(55,160,252,1) 0%,rgba(8,126,216,1) 46%,rgba(28,97,175,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(55,160,252,1) 0%,rgba(8,126,216,1) 46%,rgba(28,97,175,1) 100%); /* IE10+ */
background: linear-gradient(top, rgba(55,160,252,1) 0%,rgba(8,126,216,1) 46%,rgba(28,97,175,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#37a0fc', endColorstr='#1c61af',GradientType=0 ); /* IE6-8 */
border: 1px solid #444444;
}
#rightDiv td:hover{
color: #444444;
background: rgba(255,255,255,0.4);
border: 1px solid #999999;
text-decoration: none;
}
#rightDiv a{
color: #fff;
}
#rightDiv a:hover{
color: #444444;
}
HTML:
<div id="rightDiv">
<table width="100%" height="100%">
<tr><td>Our Plans</td></tr>
<tr><td>Our tariffs vs local mobile</td</tr>
<tr><td>Our service vs other VoIP</td></tr>
<tr><td>Our tariffs vs Skype</td></tr>
<tr><td>Tariff lookup</td></tr>
<tr><td>Become an Agent/Franchisee</td></tr>
</table>
</div>
Any suggestions on why the linear gradient breaks my pseudo classes?
Thank You
I set this up on JSFiddle, and it seems everything is working correctly as expected. http://jsfiddle.net/syjcE/
The only thing that I see is that you're setting the td:hover background color to white (background: rgba(255,255,255,0.4);). All I did was change the background color to an actual color so that you can see it's working.
Please let me know if I misunderstood the issue.