Created
November 4, 2015 18:29
-
-
Save davorbadrov/b8293e4ecf3a3d309191 to your computer and use it in GitHub Desktop.
Responsive elements with dynamic content using table styling.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<link rel="stylesheet" href="main.css"> | |
</head> | |
<body> | |
<div class="bar-container"> | |
<div class="bar"></div> | |
<div class="time">00:20</div> | |
</div> | |
<div class="bar-container"> | |
<div class="bar"></div> | |
<div class="time">01:00:20</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bar-container { | |
padding: 5px 10px; | |
background: cornflowerblue; | |
margin-bottom: 5px; | |
display: table; /* use the table property for dynamic width allocation */ | |
width: 100%; | |
} | |
.bar, .time { | |
display: table-cell; | |
} | |
.bar { | |
width: 100%; /* the bar will take all the available space */ | |
background: coral; | |
} | |
.time { | |
padding: 0 5px; /* set some padding for the time */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment