How to write CSS correctly when there are the same properties but with different prefixes for the various browser support?
Tags: css,flexbox
Problem :
If I have properties that are supported by browser with various prefixes, how I should to write the CSS
?
Example:
#example {
display: flex;
align-items: center;
justify-content: space-around;
display: -webkit-flex;
-webkit-align-items: center;
-webkit-justify-content: space-around;
display: -ms-flex;
-ms-align-items:center;
-ms-justify-content: space-around;
}
Or in this way ?
#example {
display: flex;
display: -webkit-flex;
display: -ms-flex;
align-items: center;
-webkit-align-items: center;
-ms-align-items:center;
justify-content: space-around;
-webkit-justify-content: space-around;
-ms-justify-content: space-around;
}
Or maybe there is not an order ?
Solution :
I would recommend you to use an online (or natively) tool that will automagically add the css prefixes for all browsers.
If you are using a build system like gulp or grunt, they have plugins that can automatically do this for you.
CSS Howto..
You should make that thing into li's. HTML: <ul class="usps"> <li>Denver’s Only LOCAL Ad Posting Service.</li> <li>Your first week of ad posting is FREE!!! We are that confident of our...
HTML: <p class="right">Copyright © 2012 SiteName. All Rights Reserved.<br /> <span>Powered By ScriptName</span></p> CSS: #footer .right { ... font-size: 12px; } #footer .right span { font-size: 11px; } Example: http://jsfiddle.net/4CpRk/...
Match it first: result = /^\s*\<p\>.+\<\/p\>$/.test(result) ? result : '<p>' + result + '</p>'; Instead of just adding the tags all the time....
Create admin panel where a user can enter in their style settings. Write your php code to take the data from that form, and save it to where ever...
Okay, to hide a row, apply the hide_class css class. To reshow it again, don't add the show_class css class, instead, remove the previously added hide_class css class. Also, I...
If I understand you correctly, you want to the "Name" to appear to the left while everything else is to the right? So, like this: http://jsbin.com/gejefiji/1/edit The only thing I...
Add the border-collapse:collapse; to the table css selector. This will eliminate that nested border look. Also, your Text:align:center; should really be text-align:center; Fiddle: http://jsfiddle.net/GParb/1/ CSS table{ width:100%; border-collapse:collapse; text-align:center; border:1px...
The problem seems to be with how FF interprets table cells. If you change the overflow value to 'auto' or 'scroll' it displays as if it were 'overflow:visible' which won't...
One problem is that you've configured jsfiddle such that your JavaScript code is in a "load" handler, and you've set up your event handler in a way that makes that...
You can use: table input { font-size: 13px; } ...
Please check this fiddle Markup: <div class='h2 disabled'> </div> CSS: div { height: 100px; width: 100px; border: 1px solid red; } .disabled.h2:hover { background-color: #333; } ...
CSS and "!important" work on the styling of an element, and cannot override attribute values. Therefore, IE10 probably decides that since the attribute "unselectable" is there, the element should not...
$_SERVER['REQUEST_URI'] will never contain the portion after the hash. It will only show up to about.php and any URL arguments passed with the ?. You should create specific pages for...
If you only want to change 1 or 2 things, you can use per-propery hack: From: http://codemug.com/html/css-hacks-for-ie6ie7ie8ie9-and-ie10/ #hack{ color:red; /* All browsers */ color:red !important;/* All browsers but IE6 */...
CSS how to make a fixed height?
The best solution is to put a div inside the cell with the height: <td style="padding-left:5px;"> <div style="height: 50px; overflow:hidden;"> ... </div> </td> BTW, what is the span for? If...
You have an error near your addClass, you should put $("#d1").addClass("spinEffect"); and not ".spinEffect", the . is useless there ;) For your second question, just add infinite in your css...
change your JS code like this - jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 0 && (jQuery('#menu-drop').css('display') == 'none')) { jQuery("#header").addClass("fixed"); jQuery("#header").addClass("goblack"); } else { jQuery("#header").removeClass("fixed");...
I Think you have to specify each style name in addStyleNames property in a separate bracket pair. Something like this: <g:Button text="Log Out" ui:field="logoutButton" addStyleNames="{style.gwt-Button} {style.paddedRight}" /> ...
I suggest you use a JS Validation Library as a fallback to HTML5 Validation (jQuery Validation is pretty neat). Either way, listen for submit event on the form (if using...
You can test the scroll position by comparing the height, scrollable height and scroll offset of the div: $(document).ready(function(){ $('#scrolling').scroll(function(){ var scrollTop = $(this).scrollTop(); var iheight = $(this).innerHeight(); var sheight...
Simply put, no. There is currently no selector to select TEXT only with CSS. You can (and should) use markup to get the result you're looking for: HTML: <sometag> <span>text...
Just use this CSS to overlay the image with an absolute positioned, full size pattern element: .blog-image { position: relative; display: inline-block; } .pixel-overlay { position:absolute; width: 100%; height: 100%;...
Is this what you're looking for? Updated to reflect your css. http://jsfiddle.net/jralvarez28/ezLu0482/3/ ul.mainNav1{ position: relative; list-style-type: none; margin:0; padding: 0;} ul.mainNav1 li{ display: inline-block; margin: 0; padding: 0;} ul.mainNav1 li...
Ok so I can't post comments yet but I've run into a similar problem before. Without any additional code I can make an assumption that x is the calculated value...
You can use transform: skewY(20deg) to do this. You should also consider the transform origin (the point on the element from where the transformation is calculated). In this case I...
Use ul and css: #a-form {list-style: none; margin:0; padding: 0;} #a-form li {} #a-form input {display:inline-block; margin-right: 1em;} <ul id="a-form"> <li>Position Applied For: <input type="text" name="position" value="Enter Position" size="20" />...
Every cell has border in this case by default, so you should cancel bottom border and top border of the row below: XHTML: <p:panelGrid style="width: 100%;"> <p:row> <p:column>a</p:column> <p:column>b</p:column> </p:row>...
Suppose you have an id to the div enclosing the hr <div id="hrDiv"> <hr> </div> To remove style you can use removeAttr property over the selector $("#hrDiv hr").removeAttr("style"); If you...
I would place a div around the images and place the height of the divs to 25%. HTML <div class="header"> <div class="headercontent"> <div class="socialbuttonstop"> <div class="social_btn"> <img src="Images/facebooksmall.png"/> </div> <div...
menu-item is an class? then prefix it with an dot .menu-item or if its a ID then prefix it with an # #menu-item
The best solution is to put a div inside the cell with the height: <td style="padding-left:5px;"> <div style="height: 50px; overflow:hidden;"> ... </div> </td> BTW, what is the span for? If...
You have an error near your addClass, you should put $("#d1").addClass("spinEffect"); and not ".spinEffect", the . is useless there ;) For your second question, just add infinite in your css...
change your JS code like this - jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 0 && (jQuery('#menu-drop').css('display') == 'none')) { jQuery("#header").addClass("fixed"); jQuery("#header").addClass("goblack"); } else { jQuery("#header").removeClass("fixed");...
I Think you have to specify each style name in addStyleNames property in a separate bracket pair. Something like this: <g:Button text="Log Out" ui:field="logoutButton" addStyleNames="{style.gwt-Button} {style.paddedRight}" /> ...
I suggest you use a JS Validation Library as a fallback to HTML5 Validation (jQuery Validation is pretty neat). Either way, listen for submit event on the form (if using...
You can test the scroll position by comparing the height, scrollable height and scroll offset of the div: $(document).ready(function(){ $('#scrolling').scroll(function(){ var scrollTop = $(this).scrollTop(); var iheight = $(this).innerHeight(); var sheight...
Simply put, no. There is currently no selector to select TEXT only with CSS. You can (and should) use markup to get the result you're looking for: HTML: <sometag> <span>text...
Just use this CSS to overlay the image with an absolute positioned, full size pattern element: .blog-image { position: relative; display: inline-block; } .pixel-overlay { position:absolute; width: 100%; height: 100%;...
Is this what you're looking for? Updated to reflect your css. http://jsfiddle.net/jralvarez28/ezLu0482/3/ ul.mainNav1{ position: relative; list-style-type: none; margin:0; padding: 0;} ul.mainNav1 li{ display: inline-block; margin: 0; padding: 0;} ul.mainNav1 li...
Ok so I can't post comments yet but I've run into a similar problem before. Without any additional code I can make an assumption that x is the calculated value...
You can use transform: skewY(20deg) to do this. You should also consider the transform origin (the point on the element from where the transformation is calculated). In this case I...
Use ul and css: #a-form {list-style: none; margin:0; padding: 0;} #a-form li {} #a-form input {display:inline-block; margin-right: 1em;} <ul id="a-form"> <li>Position Applied For: <input type="text" name="position" value="Enter Position" size="20" />...
Every cell has border in this case by default, so you should cancel bottom border and top border of the row below: XHTML: <p:panelGrid style="width: 100%;"> <p:row> <p:column>a</p:column> <p:column>b</p:column> </p:row>...
Suppose you have an id to the div enclosing the hr <div id="hrDiv"> <hr> </div> To remove style you can use removeAttr property over the selector $("#hrDiv hr").removeAttr("style"); If you...
I would place a div around the images and place the height of the divs to 25%. HTML <div class="header"> <div class="headercontent"> <div class="socialbuttonstop"> <div class="social_btn"> <img src="Images/facebooksmall.png"/> </div> <div...
menu-item is an class? then prefix it with an dot .menu-item or if its a ID then prefix it with an # #menu-item