pseudo elements IE10 button - css

I put together a button using :before and :after elements and IE10/9 are ignoring them completely, as far as I can tell they should be working perfectly in at least those 2 versions.
.buttonSML {
background-position:-35px -432px;
background-color: transparent;
border: none;
text-transform: uppercase;
font-size: 2.9rem;
font-weight: #font-bold;
height: 55px;
padding: 0 5px;
position: relative;
.text-shadow(0,0,4px);
cursor: pointer;
}
.buttonSML:before, .buttonSML:after {
content: " ";
position: absolute;
top: 0;
height: 55px;
width: 20px;
display: inline-block;
visibility: visible
}
.buttonSML:before {
background-image: url('../images/sprite.png');
background-position: 0px -432px;
background-repeat: no-repeat;
background-color: transparent;
left: -20px;
}
.buttonSML:after {
background: url('../images/sprite.png');
background-position: -394px -432px;
background-repeat: no-repeat;
background-color: transparent;
right: -20px;
}
Added a jsfiddle so you can see the end result http://jsfiddle.net/7D4kG/1/
Not really sure what up so would appreciate any advice you guys can provide.

After some work I found 2 solutions.
FIrst is with the help of jquery, you can replace with and add
$('#button-id').click(function ()
{
$('#form-id').submit();
});
Works well, but you loose HTML5 form validations.
To keep the validations you can skip the jquery and just add "overflow: visible" to your buttons style. Have only tested it in IE10 so far, will test the rest later when I republish.

http://jsfiddle.net/3MHHs/1/
I have made some changes and it works for me in Chrome and IE10. I completely removed the positioning, because that is very ...advanced thing in pseudos. Browsers fail on simpler cases too. I have removed the 5px padding too.
.sprite {
background-image: url('https://dl.dropboxusercontent.com/u/6374897/sprite.png')
}
.buttonSML {
background-position: -35px -432px;
background-color: transparent;
border: none;
text-transform: uppercase;
font-size: 2rem;
height: 55px;
padding: 0;
cursor: pointer;
}
.buttonSML:before, .buttonSML:after {
content: "";
width: 20px;
height: 55px;
font-size: 2rem;
display: inline-block;
vertical-align: middle;
background-repeat: no-repeat;
background-color: white; /* sorry */
background-image: url('https://dl.dropboxusercontent.com/u/6374897/sprite.png');
}
.buttonSML:before {
background-position: 0px -432px;
}
.buttonSML:after {
background-position: -394px -432px;
}

Related

background-image not displaying in Chrome or IE

The background-image works in Firefox, but not in Chrome or IE. I have tried several solutions on Stackoverflow,
like turning off my ad-block,
putting the same code in the head of the file,
<head><style>...</style><head>
putting the same code in the style attribute of the link,
<a style="..."> ... </a>
I have made sure there are no elements that are derived from the appearance attribute,
I have tried including the background-attachment: fixed; style
and finally I have tried to change:
background-position-y: 465px;
background-position-x: 5px;
To:
background-position: left center;
All of these variations on the below code work perfectly in Firefox.
.search-btn {
padding-left: 32px;
padding-right: 10px;
background-image: url(../Images/search.png);
background-position-y: 465px;
background-position-x: 5px;
background-repeat: no-repeat;
}
But not on Chrome or Internet Explorer.
<asp:LinkButton ID="btnSearch" runat="server" CssClass="btn blue-btn mar-bot search-btn" OnClick="btnSearch_Click">Search</asp:LinkButton>
The other classes mentioned in the CssClass attribute in the order the appear in my CSS stylesheet:
.mar-bot {
margin-bottom: 6px;
}
.blue-btn {
background-color: #55acee;
box-shadow: 0px 5px 0px 0px #3C93D5;
}
.blue-btn:hover {
background-color: #6FC6FF;
}
.btn {
border-radius: 5px;
padding: 4px 8px;
text-decoration: none;
color: #fff;
position: relative;
display: inline-block;
}
.btn:active {
transform: translate(0px, 5px);
-webkit-transform: translate(0px, 5px);
box-shadow: 0px 1px 0px 0px;
}
.search-btn {
...
}
.search-btn {
padding-left: 32px;
padding-right: 10px;
background-image: url(../Images/search.png);
background-position: left center;
background-repeat: no-repeat;
display: inline-block;
}
For some reason it needs display: inline-block; to work.
I have no idea why this worked, but it does.

CSS - Background-image

I have set background-image for my menu's background, as for the black bar behind the menu:
http://www.cochlea.co.il/
background-image: url("http://www.cochlea.co.il/wp-content/uploads/2015/07/bar.png");
background-repeat: no-repeat;
background-position: inherit;
But, sometimes the black background won't load. and sometimes when you scroll down and then up, it disappears.
What's the problem?
Thanks so much.
I noticed that it is getting hide whenever we are scrolling down.
Well how about if you remove the background-image and allow the background to be black?
Use this code
.main-navigation ul {
list-style: none;
margin: 0;
display: inline;
background: #000;
padding: 5px;
border-radius: 28px;
padding-left: 30px;
padding-right: 30px;
}
.theNavigationBar {
position: absolute;
width: 100%;
top: 15px;
left: 0;
text-align: center;
font-weight: bold;
/* background-image: url("http://www.cochlea.co.il/wp-content/uploads/2015/07/bar.png"); */
/* background-repeat: no-repeat; */
/* background-position: inherit; */
/* letter-spacing: 0.5px; */
}
It will do the same purpose of what is your background-image is doing. So simply use the above code.

How to make a custom cursor appear on an entire page and not just one small portion

I have seen this, but it does not provide any solution to my programming issues:
Custom cursor to entire page
This is the CSS Markup:
body {
height: 100%; width: 100%; padding: 0; margin: 0;
background: #000 url('http://1hdwallpapers.com/wallpapers/undead_dragon.jpg') no-repeat fixed center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover; font-size:12px; font-weight:bold;
cursor: url('http://www.rw-designer.com/cursor-view/21962.png'), auto;
}
div#mask {
cursor: not-allowed;
z-index: 999;
height: 100%;
width: 100%;
}
a:link {
color: #ffffff;
font-weight: normal;
text-decoration: none;
}
a:visited {
color: #ffffff;
font-weight: bold;
text-decoration: line-through;
}
a:active {
color: #F433FF;
font-weight: normal;
text-decoration: blink;
}
a:hover {
color: #F433FF;
font-weight: bold;
text-decoration: blink;
}
#about_me
div.center {
margin-left: auto;
margin-right: auto;
width: 8em;
}
{
width: 355px;
float: right;
margin: 20px 0px 0px 0px;
}
.contentTitle {
color: #fff;
background: #000;
}
.contentModule {
color: #FF00FF;
border: 1px solid transparent;
background: transparent;
cursor: pointer;
}
#right_column {
float: left;
width: 355px;
margin: 20px 0 0 20px;
}
#left_column {
width: 210px;
margin-bottom: 10px;
margin-right: 0px;
float: left;
}
#pet_panel {
position: absolute;
top: 80px;
right: 700px;
margin-top: 50px;
width: 40%; float: left; margin: 0 0 20px 0;
}
#comment_panel {
position: absolute;
top: 700px;
right: 85px;
margin-top: 50px;
}
#tombstone_panel {
position: absolute;
top: 30px;
right: 85px;
margin-top: 50px;
}
#user_panel {
position: absolute;
top: 30px;
right: 385px;
margin-top: 50px;
}
#wishlist_panel {
position: absolute;
top: 250px;
right: 85px;
margin-top: 50px;
}
This is the HTML Markup:
<div id="about_me" class="contentModule">
<div class="contentTitle">About Me</div>
<div class="contentModuleI">my tagline </div>
</div>
What can I do to make my custom cursor visible throughout my page like the default cursor is?
If you need to display custom cursor on full page you have to add CSS like this. Have a look at DEMO.
body, html
{
height: 100%;
width: 100%;
padding: 0;
margin: 0;
background: #000 url('http://1hdwallpapers.com/wallpapers/undead_dragon.jpg') no-repeat fixed center;
cursor:url('http://www.rw-designer.com/cursor-view/21962.png'), url('cute25.cur'), help;
}
so here explain how it works; Firefox and chrome are fine with .jpg or .png file extension. But to support in IE need a .cur file extension. You may convert your image into .cur extension. from this online tool.
Note: If you need it work also in IE then you have to use cursor .cur file extension.

Can't tab to my styled anchor tags in MVC3 application

I have an MVC application which requires nice rounded buttons and to work on IE7.
I have found some code to style anchor tags so as to make them look like nice buttons.
Unfortunately, they seem to be totally outside of the tabbing order (I can't navigate to those controls by pressing tab). On some screens I can fix this by adding tabindex to all of the controls on the form, but unfortunately it is not possible to do this on all screens (for instance I sometimes use partial views).
Note tabbing to the controls also doesn't work in FireFox.
My "buttons" are placed like so:
<a class="btn green" id="Submit">Save</a>
There is some javascript, which adds some and tags to this class to allow it to have rounded corners, so the anchor tags are converted to this:
<a class="btn green" id="Submit"><i></i><span><i></i><span></span>Save</span></a>
and they are styled with the following css:
.btn { display: block; position: relative; background: #aaa; padding: 5px; float: left; color: #fff; text-decoration: none; cursor: pointer; }
.btn * { font-style: normal; background-image: url(images/btn2.png); background-repeat: no-repeat; display: block; position: relative; }
.btn i { background-position: top left; position: absolute; margin-bottom: -5px; top: 0; left: 0; width: 5px; height: 5px; }
.btn span { background-position: bottom left; left: -5px; padding: 0 0 5px 10px; margin-bottom: -5px; }
.btn span i { background-position: bottom right; margin-bottom: 0; position: absolute; left: 100%; width: 10px; height: 100%; top: 0; }
.btn span span { background-position: top right; position: absolute; right: -10px; margin-left: 10px; top: -5px; height: 0; }
a.btn {color: #333;text-decoration: none; font-weight:bold; font-family: Arial; font-size: 12px; }
* html .btn span,
* html .btn i { float: left; width: auto; background-image: none; cursor: pointer; }
.btn.green { background: rgb(175,211,86); }
.btn:hover { background-color: #FFF; }
.btn:focus { background-color: #FFF; }
.btnFocus { background-color: #FFF !important; }
.btn:active { background-color: #444; }
.btn[class] { background-image: url(images/shade.png); background-position: bottom; }
* html .btn { border: 3px double #aaa; }
* html .btn.green { border-color: #9d4; }
* html .btn:hover { border-color: #a00; }
Ah, just figured it out.
It works fine if we add an href attribute to the anchor tags
<a class="btn green" id="Submit" href="#">Save</a>
Sorry to trouble everyone.

CSS fake HR with background image

I want to have a HR like background image. a 2 pixel wide gif file.
I looked into styling the HR tag, but too much browser issues..
Used a 2px high div with the image as bg, but in IE6, there is a padding I can not seem to get rid of.
Any suggestions welcome!
CSS:
.hr {
margin: 0; padding: 0;
height: 2px;
background-image: url('images/help-hr.gif');
background-repeat: repeat-x;
background-color: green; /* just to see the padding in IE6 */
}
HTML:
<p>sky</p>
<div class="hr"></div>
<p>grass</p>
Add overflow:hidden;
.hr {
margin: 0; padding: 0;
height: 2px;
background-image: url('images/help-hr.gif');
background-repeat: repeat-x;
background-color: green; /* just to see the padding in IE6 */
overflow:hidden;
}
I do not know the answer to the IE6 issue you're dealing with, but I had the same issue with using hr and found a solution that worked for me:
hr {
background-color: #ccc;
border-width: 0;
color: #ccc;
height: 2px;
line-height: 0;
margin: -.5em 10px 1.8571em 10px;
page-break-after: always;
text-align: center;
width: 80%;
}
hr:after {
content: "\a7\a7";
font-size: 1.25em;
}

Resources