0

This is my approach to implement a simple diary day:

<div class="panel panel-primary">
  <div class="panel-heading">June</div>
  <div class="panel-body">
25
<br>
 <span class="glyphicon glyphicon-time"></span>
  </div>
</div>

and here is the css code:

.panel{
    border-color:#EEEEEE !important;
    width: 150px;
}

.panel > .panel-heading {
    background-color: greenyellow;
    color: white;
    height: 40px;
    text-align: center;
    border-color:black !important;
    font-size: 20px;
}

.panel> .panel-body{
    text-align: center;
    font-family: "Comic Sans MS";
    font-size: 35px;   
}

.glyphicon{
    font-size: 20px !important;
    text-align: left !important;
}

What I want is to align the glyphicon at the left, but because of been nested to panel-body, which alignment is center, this cannot be happened. Even if i tried "!important".

Any help is welcome

1 Answer 1

1

Just bring it outside class="panel-body" That will do the trick.

Working example

<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
          <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
           <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
           <style type="text/css">
             .panel{
    border-color:#EEEEEE !important;
    width: 150px;
}

.panel > .panel-heading {
    background-color: greenyellow;
    color: white;
    height: 40px;
    text-align: center;
    border-color:black !important;
    font-size: 20px;
}

.panel> .panel-body{
    text-align: center;
    font-family: "Comic Sans MS";
    font-size: 35px;   
}

.glyphicon{
    font-size: 20px !important;
    text-align: left !important;
}
           </style>
           
           </head>
           <body>
           <div class="panel panel-primary">
  <div class="panel-heading">June</div>
  <div class="panel-body">
25
<br>
  </div>
 <span class="glyphicon glyphicon-time"></span>

</div>

           </body>
           </html>

` Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

it does! Quick and easy. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.