Created
August 31, 2015 18:23
-
-
Save jasonyarrington/9772bd987ace43a59e32 to your computer and use it in GitHub Desktop.
Table Cell
This file contains hidden or 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style type="text/css"> | |
.header { | |
border: 1px solid red; | |
display: table; | |
width: 100%; | |
table-layout: fixed; | |
} | |
.header > div { | |
display: table-cell; | |
border: 1px solid blue; | |
position: relative; | |
} | |
.left { | |
width: calc(100% - 130px); | |
max-width: calc(100% - 130px); | |
} | |
.right { | |
width: 130px; | |
text-align: right; | |
position: relative; | |
} | |
.wrap { | |
white-space: nowrap; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
width: 100%; | |
max-width: 100%; | |
display: block; | |
} | |
.active .right { | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="header"> | |
<div class="left "> | |
<div class="wrap">Refine Jewelry and Accessories | |
</div> | |
</div> | |
<div class="right"> | |
<button>Refine</button> | |
</div> | |
</div> | |
<div class="my-button"> | |
<button>Show/Hide</button> | |
</div> | |
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> | |
<script type="text/javascript"> | |
var myButton = $('.my-button'); | |
var header = $('.header'); | |
myButton.on('click', function() { | |
if (header.hasClass('active')) { | |
header.removeClass('active'); | |
} else { | |
header.addClass('active'); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment