CSS Property Value How to - Use Media Queries and Floating/Breaking Spans








Question

We would like to know how to use Media Queries and Floating/Breaking Spans.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.left {<!--   w ww.  j  a v a 2 s .c o m-->
  float: left;
}

.right {
  clear: left;
  float: left;
}

@media ( min-width : 500px) {
  .right {
    float: right;
    clear: none;
  }
}
</style>
</head>
<body>
  <p>
    <span class="left">Some text. </span>
    <span class="right">Some occasionally-floated text.</span>
  </p>
</body>
</html>

The code above is rendered as follows: