I'm trying to make my footer responsive so after reading and using some example I have make one but it's not as I want to.
I want to display the Data protection disclaimer contact in a row and not one upside one.
.table {
position: relative;
right: 0;
bottom: 0;
left: 0;
height: 50px;
line-height: 50px;
clear: both;
color: white;
background-color: black;
font-size: 14px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
z-index: 10;
display:table;
width:100%;
}
.table > div {
display:table-cell;
width:33%;
}
.table > .cell150 {
width:33%;
}
.cell150:before {
content:'';
display:inline-block;
width:33%;
}
.a{
background-color: blue;
}
.b{
background-color: yellow;
}
.c{
background-color: pink;
}
<div class="table">
<div class="cell150 a">
V 1.1
</div>
<div class="cell150 b">
Hi StackOverflow
</div>
<div class="cell150 c">
<div class="col-xs-4 col-sm-8 col-md-4">
Data protectionDisclaimer<a class="footer-item">Contact</a>
</div>
</div>
</div>
Ok so here I don't know why it is displaying as I want to... but in my case it's like this:
Do you guys have an idea how to solve this ?
Check out this.
Change col-md-4 to col-md-12
note : see the result in full page view
.table {
position: relative;
right: 0;
bottom: 0;
left: 0;
height: 50px;
line-height: 50px;
clear: both;
color: white;
background-color: black;
font-size: 14px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
z-index: 10;
display: table;
width: 100%;
}
.table>div {
display: table-cell;
width: 33%;
}
.table>.cell150 {
width: 33%;
}
.cell150:before {
content: '';
display: inline-block;
width: 33%;
}
.a {
background-color: blue;
}
.b {
background-color: yellow;
}
.c {
background-color: pink;
}
.footer-item {
margin: 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="table">
<div class="cell150 a">
V 1.1
</div>
<div class="cell150 b">
Hi StackOverflow
</div>
<div class="cell150 c">
<div class="col-xs-4 col-sm-8 col-md-12">
Data protectionDisclaimer<a class="footer-item">Contact</a>
</div>
</div>
</div>
<div class="table">
<div class="cell150 a">
V 1.1
</div>
<div class="cell150 b">
Hi StackOverflow
</div>
<div class="cell150 c">
<div class="col-xs-12 col-sm-12 col-md-12">
<ul>
<li>Data protection </li>
<li>Disclaimer </li>
<li><a class="footer-item">Contact</a> </li>
</ul>
</div>
</div>
</div>
ul {
list-style: none;
padding: 0px;
}
ul li {
display: inline;
padding: 3px;
}
Like this? Although in xs screen, they will be in separate lines
.table {
text-align: center;
position: relative;
right: 0;
bottom: 0;
left: 0;
height: 50px;
line-height: 50px;
clear: both;
color: white;
background-color: black;
font-size: 14px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
z-index: 10;
display: table;
width: 100%;
}
.table>div {
display: table-cell;
width: 33%;
}
.table>.cell150 {
width: 33%;
}
.cell150:before {
content: '';
display: inline-block;
width: 33%;
}
.a {
background-color: blue;
}
.b {
background-color: yellow;
}
.c {
background-color: pink;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="table">
<div class="col-xs-4 a">
V 1.1
</div>
<div class="col-xs-4 b">
Hi StackOverflow
</div>
<div class="col-xs-4 c">
<div class="col-xs-12 ">
Data protection
Disclaimer
<a class="col-sm-4 footer-item">Contact</a>
</div>
</div>
</div>
Related
I would like to have space after the table. I know that <br> works, but I want to find out if there is a CSS attribute I can add that will make it unnecessary.
.bold {
font-weight: bold;
}
.body-settings {
font-family: opensans, sans-serif;
font-size: 15px;
line-height: 22px;
margin: 0;
background-color: black;
}
.site-wrapper {
background-color: lightyellow;
max-width: 50%;
margin: 0 auto;
padding: 30px;
position: relative;
}
.rTable {
display: table;
width: 100%;
margin-bottom: 1em;
}
.rTableRow {
display: table-row;
}
.rTableCell {
display: table-cell;
}
.rTableCellBold {
font-weight: bold;
}
<body class="body-settings">
<div class="site-wrapper">
<div class="rTable">
<div class="rTableRow">
<div class="rTableCellBold">Subject Name:</div>
<div class="rTableCell"> John Doe</div>
</div>
<div class="rTableRow">
<div class="rTableCellBold">Occupation:</div>
<div class="rTableCell"> Professional Impersonator</div>
</div>
</div>
<div class="bold">
Executive Summary
</div>
</div>
<body>
You can just use margin-bottom on rTable.
.body-settings {
font-family: opensans, sans-serif;
font-size: 15px;
line-height: 22px;
margin: 0;
background-color: black;
}
.site-wrapper {
background-color: lightyellow;
max-width: 50%;
margin: 0 auto;
padding: 30px;
position: relative;
}
.rTable {
display: table;
width: 100%;
margin-bottom:20px;
}
.rTableRow {
display: table-row;
}
.rTableCell {
display: table-cell;
}
<body class="body-settings">
<div class="site-wrapper">
<div class="rTable">
<div class="rTableRow">
<div class="rTableCellBold">Subject Name:</div>
<div class="rTableCell"> John Doe</div>
</div>
<div class="rTableRow">
<div class="rTableCellBold">Occupation:</div>
<div class="rTableCell"> Professional Impersonator</div>
</div>
</div>
<div class="bold">
Executive Summary
</div>
</div>
</body>
The actual problem was that I did not add rTableCellBold to the display: table-cell; list:
.rTableCell, rTableCellBold {
display: table-cell;
}
After this change, I was able to use
.rTable {
display: table;
width: 100%;
margin-bottom: 1em;
}
There are 3 block different size in a row. How can I make them responsive, because in mobile version they overlay at each other.
.watch {
position: absolute;
bottom: 0;
left: 50px;
width: 224px;
height: 69px;
cursor: pointer;
background-color: #918A83;
opacity: 0.85;
}
.watch-elements {
margin: 20px 20px;
}
.watch p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
.mouse {
position: absolute;
bottom: 0;
border: 1px solid #DAD3CC;
width: 577px;
height: 69px;
cursor: pointer;
background-color: #fff;
}
.mouse-elements {
text-align: center;
margin-top: 10px;
}
.mouse p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #000;
}
.chat-bot {
position: absolute;
bottom: 20px;
background-color: #09A753;
border-radius: 100px;
right: 100px;
width: 227px;
height: 39px;
cursor: pointer;
}
.chat-bot img {
margin-top: -20px;
margin-left: -15px;
}
.chat-bot p {
display: flex;
justify-content: center;
text-align: center;
margin-top: -15px;
flex-direction: row;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
#media all and (max-width: 1024px) {
.watch img {
position: absolute;
float: left;
left: 0;
}
.watch p {
margin-left: 20px;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="container mt-5">
<h2 class="header-text">Practical business advice and knowhow<br>customized to your needs</h2>
</div>
</div>
<div class="d-flex justify-content-left">
<div class="watch">
<div class="watch-elements">
<img src="assets/img/icons/icon2.svg">
<p>Watch Presenation</p>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="mouse">
<div class="mouse-elements">
<img src="assets/img/icons/Icon1.svg"><br>
<p>Scroll Down</p>
</div>
</div>
</div>
<div class="d-flex justify-content-right">
<div class="chat-bot">
<img src="assets/img/06w.png">
<p>Hi, can I help you?</p>
<img src="assets/img/icons/icon3.svg" style="float: right; margin-right: -60px; margin-top: -39px;">
</div>
</div>
</div>
Now, they arrange in a row as on image
In mobile version left block disappears and I can not see it, also second and third block overlay at each other.
For mobile devices please try position: relative instead of position: absolute. Don't forget to adjust other CSS values as per your requirements. Hope this will solve your issues
#media all and (max-width: 767px) {
.watch, .mouse, .chat-bot{
position:relative;
right:auto;
left:auto;
top:auto;
bottom:auto;
margin:5px 0
}
}
I have put all the elements inside a div with class footer. and used bootstrap flex css properties to align it. Hope its helps you. thanks
.watch {
width: 224px;
height: 69px;
cursor: pointer;
background-color: #918A83;
opacity: 0.85;
}
.watch-elements {
margin: 20px 20px;
}
.watch p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
.mouse {
border: 1px solid #DAD3CC;
width: 577px;
height: 69px;
cursor: pointer;
background-color: #fff;
}
.mouse-elements {
text-align: center;
margin-top: 10px;
}
.mouse p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #000;
}
.chat-bot {
background-color: #09A753;
border-radius: 100px;
right: 100px;
width: 227px;
height: 39px;
cursor: pointer;
}
.chat-bot img {
margin-top: -20px;
margin-left: -15px;
}
.chat-bot p {
display: flex;
justify-content: center;
text-align: center;
margin-top: -15px;
flex-direction: row;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
#media all and (max-width: 1024px) {
.watch img {
position: absolute;
float: left;
left: 0;
}
.watch p {
margin-left: 20px;
}
}
.footer {
position: absolute;
bottom: 0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="container mt-5">
<h2 class="header-text">Practical business advice and knowhow<br>customized to your needs</h2>
</div>
</div>
<div class="d-flex footer justify-content-sm-center align-content-between flex-sm-wrap flex-lg-nowrap">
<div class="d-flex justify-content-left">
<div class="watch">
<div class="watch-elements">
<img src="assets/img/icons/icon2.svg">
<p>Watch Presenation</p>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="mouse">
<div class="mouse-elements">
<img src="assets/img/icons/Icon1.svg"><br>
<p>Scroll Down</p>
</div>
</div>
</div>
<div class="d-flex justify-content-right align-items-center">
<div class="chat-bot">
<img src="assets/img/06w.png">
<p>Hi, can I help you?</p>
<img src="assets/img/icons/icon3.svg" style="float: right; margin-right: -60px; margin-top: -39px;">
</div>
</div>
</div>
</div>
you can try replacing your existing divs with the below ones
<div class="d-flex justify-content-left col-lg-3 col-md-6 col-xs-12">
<div class="d-flex justify-content-center col-lg-3 col-md-6 col-xs-12">
<div class="d-flex justify-content-right col-lg-3 col-md-6 col-xs-12">
position:absolute and related properties are not suitable for this function. You can use CSS flexbox layout
For more information use this link: Complete Guide to Flexbox
I explain simple usage of flexbox layout using example:
#wrapper{display:flex;flex-wrap:wrap;justify-content:space-between}
/*just for styles*/
#wrapper div{background-color:#f5f5f5;text-align:center;padding:2px 5px;margin:2px}
#e3{width:200px}
<div id="wrapper">
<div id="e1">element 1</div>
<div id="e2">element 2</div>
<div id="e3">element 3</div>
<div id="e4">element 4</div>
</div>
Also with flex layout you can manipulate elements places based on viewport size with order property.
I have a 3 column tile responsive design that's 1 column in mobile and 3 columns in desktop and each tile has a content drawer that needs to stretch the FULL width of the screen (complete with blue background).
I have a working model in a pen below but can't get the drawers to stretch full width?
Not sure if it's CSS or if there's a more optimum HTML layout as doing the mobile first design and it works, just not in Desktop/wider views.
Codepen:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
function openDrawer(tile) {
var drawer = $(tile).attr("drawer");
if ( $(tile).hasClass("ESGActive") ){ // Already is active?
$(".ESGTile").removeClass("ESGActive");
$("#" + drawer).slideUp();
} else {
// Get all tiles with class="ESGActive" and remove it
$(".ESGTile").removeClass("ESGActive");
// Get all elements with class="ESGDrawer" and hide them
$(".ESGDrawer").slideUp();
// Show the current tab drawer, add "active" class to the button
$("#" + drawer).slideDown();
$(tile).addClass("ESGActive");a
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
.ESGTiles > div{
display:inline;
padding:0;
}
.ESGDrawer {
float:left;
margin:0;
}
.ESGTile > img{
display:none;
}
#media screen and (min-width: 1024px){
.ESGTile > img, .FAQTile > img {
display:block;
}
.ESGTiles > div{
padding:15px;
}
}
#media screen and (max-width: 1024px){
.ESGDrawer {
margin-top: 0!important;
padding: 2em 0!important;
}
.FAQTile img, .ESGDrawer img {
display: none;
}
.ESGTile, .FAQTile {
margin: 0.2em 0;
}
span.drawerToggle {
position: relative;
width: 24px!important;
height: 24px!important;
float:right;
}
.call-to-action img {
width: 70%;
margin: 0 auto 2em auto;
}
}
.FAQTile {
background: #36872a!important;
width: 100%;
}
.drawerToggle{
position: relative;
width: 30px;
height: 30px;
float:right;
}
.drawerToggle:before, .drawerToggle:after{
content: "";
position: absolute;
background-color: white;
transition: transform 0.25s ease-out;
}
.drawerToggle:before{
top: -1px;
left: 50%;
width: 2px;
height: 100%;
margin-left: -1px;
}
.drawerToggle:after{
top: 50%;
left: 0;
width: 100%;
height: 2px;
margin-top: -2px;
}
/**.ESGTile:hover .drawerToggle:before{ transform: rotate(90deg); }
.ESGTile:hover .drawerToggle:after{ transform: rotate(180deg); }**/
.ESGActive .drawerToggle:before{ transform: rotate(90deg); }
.ESGActive .drawerToggle:after{ transform: rotate(180deg); }
.ESGTile, .FAQTile {
display: block;
position: relative;
cursor: pointer;
overflow: hidden;
background-color: #1f335a;
color: #fff;
z-index: 100;
font-weight: 700;
}
.ESGTile h3, .FAQTile h3 {
color: #fff;
}
.ESGTile:hover {
background-color: #344794;
color: #fff;
text-decoration: none;
}
.FAQTile:hover {
background-color: #00a651!important;
color: #fff;
text-decoration: none;
}
.ESGActive {
background: #344794;
}
.ESGActive:after {
bottom: -3px;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
z-index: 120;
pointer-events: none;
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.ESGTile h3, .FAQTile h3 {
font-size: 1.2em;
}
.ESGLabel, .FAQLabel {
margin: 0;
display: block;
padding: 0.8em 15px;
}
.ESGDrawer {
display: none;
background: #1f335a;
color: #fff;
padding: 4em 0;
margin-top: 0.3em;
z-index: 90;
position:inline-block;
width:100vw;
left:0;
}
.ESGDrawer h4 {
font-size: 1.8em;
margin-bottom: 1em;
}
.ESGDrawer p {
line-height: 1.4em;
}
.ESGDrawer p.cta-wrapper {
margin: 0.3em 0 0 0;
}
.ESGDrawer p.cta-wrapper a:before {
bottom: 0;
}
.ESGDrawer a:link, .ESGDrawer a:hover, .ESGDrawer a:visited {
text-decoration: none;
color: #fff;
}
hr {
display: none;
}
.call-to-action {
padding: 3em 0;
}
footer {
margin-top: 0;
}
<div class="container">
<div class="row">
<!-- TILE 1 *********************** -->
<div class="col-xs-12 col-md-4">
<!-- Tile -->
<a class="ESGTile" onclick="openDrawer(this)" drawer="title-1">
<img class="img-responsive" src="http://www.kamunga.com/test.jpg" height="360" width="640">
<h3 class="ESGLabel">Title 1<span class="drawerToggle"></span></h3>
</a>
<!-- Drawer -->
<div id="title-1" class="container-fluid ESGDrawer">
<div class="container ESGMiddleDrawerContent">
<div class="row">
<div class="col-xs-12 col-md-6">
<h4>Title 1</h4>
<p>Lorem ipsum</p><p>Lorem ipsum</p>
</div>
</div>
</div>
</div>
</div>
<!-- TILE 2 *********************** -->
<div class="col-xs-12 col-md-4">
<!-- Tile -->
<a class="ESGTile" onclick="openDrawer(this)" drawer="title-2">
<img class="img-responsive" src="http://www.kamunga.com/test.jpg" height="360" width="640">
<h3 class="ESGLabel">Title 2<span class="drawerToggle"></span></h3>
</a>
<!-- Drawer -->
<div id="title-2" class="container-fluid ESGDrawer">
<div class="container ESGMiddleDrawerContent">
<div class="row">
<div class="col-xs-12 col-md-6">
<h4>Title 2</h4>
<p>Lorem ipsum</p><p>Lorem ipsum</p>
</div>
</div>
</div>
</div>
</div>
<!-- TILE 3 *********************** -->
<div class="col-xs-12 col-md-4">
<!-- Tile -->
<a class="ESGTile" onclick="openDrawer(this)" drawer="title-3">
<img class="img-responsive" src="http://www.kamunga.com/test.jpg" height="360" width="640">
<h3 class="ESGLabel">Title 3<span class="drawerToggle"></span></h3>
</a>
<!-- Drawer -->
<div id="title-3" class="container-fluid ESGDrawer">
<div class="container ESGMiddleDrawerContent">
<div class="row">
<div class="col-xs-12 col-md-6">
<h4>Title 3</h4>
<p>Lorem ipsum</p><p>Lorem ipsum</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Here you're
I added this code at the end of the CSS
.body {
position: relative;
}
.ESGDrawer {
position: absolute;
top: 247px;
left: 0px;
width: 100%;
}
.x{
position: inherit;
}
and I add a new classname to each of your col-xs-12 col-md-4 divs
Check the working demo here
https://codepen.io/anon/pen/JaQPjN
I currently have an event tracker made using html and css. My issue is that I would like to get ride of display: flex; due to browser-compatibility issues. Is there an alternative to achieve the same result? I tried using display:inline-block because without flex all steps were coming in different lines.
HTML:
<div class="container">
<div class="row event">
<div class="col-xs-3 event-step">
<p class="event-stepnum">Step 1</p>
<div class="progress">
<div class="progress-bar"></div>
</div>
</div>
<div class="col-xs-3 event-step complete">
<p class="event-stepnum">Step 2</p>
<div class="progress">
<div class="progress-bar"></div>
</div>
</div>
<div class="col-xs-3 event-step">
<p class="event-stepnum">Step 3</p>
<div class="progress">
<div class="progress-bar"></div>
</div>
</div>
</div>
</div>
CSS:
.event > .event-step {
padding: 0;
position: relative;
}
.event > .event-step .event-stepnum {
color: #595959;
font-size: 16px;
margin-bottom: 5px;
}
.steps .step-on,
.steps .step-done {
background-color: #1b7e28;
color: #1b7e28;
border: 1px solid transparent;
}
.progress {
position: relative;
border-radius: 0px;
height: 5px;
box-shadow: none;
margin: 20px 0;
}
.progress > .progress-bar {
width: 0px;
box-shadow: none;
background: #fbe8aa;
}
.event-step.complete > .progress > .progress-bar {
width: 100%;
}
.row {
display:flex;
}
JSFiddle Demo
Just replace the display:flex by display:inline-block and give your step divs a fixed width:
.event > .event-step {
padding: 0;
position: relative;
width: 200px;
}
.row {
display: inline-block;
}
https://jsfiddle.net/onk2cqhg/
I am attempting to add a bottom border to a div for the purpose of a navigation bar. The effect I am trying to achieve:
Currently, I have the following code:
$("a").click(function() {
$("a").removeClass("current");
$(this).addClass("current");
});
.container {
}
.container .item {
float: left;
list-style-type: none;
margin: 0 1px;
}
.container .item a {
color: black;
text-decoration: none;
background-color: green;
width: 50px;
font-size: 13px;
text-align: center;
font-weight: bold;
display: table-cell;
vertical-align: middle;
height: 40px;
}
.container .item a.current {
border-bottom: 2px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="container">
<div class="item">
<a class="current" href="#">Page 1</a>
</div>
<div class="item">
Page 2
</div>
<div class="item">
Page 3
</div>
<div class="item">
Page 4
</div>
<div class="item">
Page 5
</div>
<div class="item">
Page 6
</div>
</div>
I cannot find a way to add the empty space in between the content of the div and the bottom border without it being the same colour as the div background.
As it currently stands you can't do this. You can't add a gap between an element and its own border. You can, however, add the border to its parent element (the div.item element in this case), then add padding-bottom to that same element to separate it from the a element:
$("a").click(function() {
$(".current").removeClass("current");
$(this).parent().addClass("current");
});
.container {
}
.container .item {
float: left;
list-style-type: none;
margin: 0 1px;
}
.container .item a {
color: black;
text-decoration: none;
background-color: green;
width: 50px;
font-size: 13px;
text-align: center;
font-weight: bold;
display: table-cell;
vertical-align: middle;
height: 40px;
}
.container .item.current {
border-bottom: 2px solid red;
padding-bottom: 4px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="container">
<div class="item current">
Page 1
</div>
<div class="item">
Page 2
</div>
<div class="item">
Page 3
</div>
<div class="item">
Page 4
</div>
<div class="item">
Page 5
</div>
<div class="item">
Page 6
</div>
</div>
Note that I've also modified your JavaScript to add this .current class to the li element and not the clicked a element.
demo
new css:
.container {
}
.container .item {
float: left;
list-style-type: none;
margin: 0 1px;
border-bottom: 8px solid red;
}
.container .item a {
color: black;
text-decoration: none;
background-color: green;
width: 50px;
font-size: 13px;
text-align: center;
font-weight: bold;
display: table-cell;
vertical-align: middle;
height: 40px;
border-bottom: 4px solid white;
}
.container .item a.current {
}
One more version using :after pseudo element. Unlike other answers this will put white border inside of element, not push the green further outside.
The interesting parts I added/changed:
.container .item a {
...
position: relative;
}
.container .item a.current:after {
content:'';
position: absolute;
left: 0;
bottom: 2px;
height: 2px;
width: 100%;
background-color: #FFF;
}
And here is a demo:
$("a").click(function() {
$("a").removeClass("current");
$(this).addClass("current");
});
.container {
}
.container .item {
float: left;
list-style-type: none;
margin: 0 1px;
}
.container .item a {
color: black;
text-decoration: none;
background-color: green;
width: 50px;
font-size: 13px;
text-align: center;
font-weight: bold;
display: table-cell;
vertical-align: middle;
height: 40px;
position: relative;
}
.container .item a.current {
border-bottom: 2px solid red;
}
.container .item a.current:after {
content:'';
position: absolute;
left: 0;
bottom: 2px;
height: 2px;
width: 100%;
background-color: #FFF;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="container">
<div class="item">
<a class="current" href="#">Page 1</a>
</div>
<div class="item">
Page 2
</div>
<div class="item">
Page 3
</div>
</div>
Demo: http://jsfiddle.net/osajfgLc/
Not sure whether this is what you want. Try this. I added a div with class box. This also can be done using css after method.
$("a").click(function() {
$("a").removeClass("current");
$(this).addClass("current");
});
.container {
}
.container .item {
float: left;
list-style-type: none;
margin: 0 1px;
}
.container .item a {
color: black;
text-decoration: none;
background-color: green;
width: 50px;
font-size: 13px;
text-align: center;
font-weight: bold;
display: table-cell;
vertical-align: middle;
height: 40px;
}
.box {
margin-top:2px;
height: 2px;
background-color:red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="container">
<div class="item">
<a class="current" href="#">Page 1</a>
<div class="box"></div>
</div>
<div class="item">
Page 2
</div>
<div class="item">
Page 3
</div>
<div class="item">
Page 4
</div>
<div class="item">
Page 5
</div>
<div class="item">
Page 6
</div>
</div>