Are there issues with mixing percentages and pixels in the same rule?

Just simply wondering if using percentages and pixels in the same css rule is bad practice, and if so what the bi-product of this would be.

Examples:

.left {
    width:59%;
    height:500px;
    float:left;
    margin-right:5.1%;
    background:rgba(0, 0, 0, 0.70);
    background-repeat:repeat;
    margin-top:5%;
}
.pic {
    width:90%;
    height:90%;
    margin:25px auto 0 auto;
    background:url('img/picOne.png');
    background-position:center center;
    -webkit-background-size:cover;
    -moz-background-size:cover;
    -o-background-size:cover;
    background-size:cover;
}

Answers


I have never encountered that as a best practice. Function trumps and code style (potential?) concerns, as you might need a percentage width and a pixel height, for example. For instance, if you had a three column layout, and needed a fixed height, you might do something like,

.elements {
  width: 33%;
  height: 300px;
}

I would say use the same measurements if the two units make no functional difference, but otherwise use what is needed.


Need Your Help

Plotting block data in 3d using different colors and smoothing the lines in Gnuplot or Octave

gnuplot octave

I am trying to plot (with Gnuplot) some basic 3d data from one file which is pretty much like that:

Explicit resolving of ILog in Autofac when using with Log Injection Module

c# .net dependency-injection log4net autofac

I use the following code in order to register log4net for all the classes that need it.