How do I position the icon to the right of the heading? - html

I would like the layout to look as so, but also be responsive (so that the heading + paragraph both stay positioned to the left of the icon).
CSS:
.feature {
position: relative;
border: 1px solid #000;
}
.circle {
height: 2.5rem;
width: 2.5rem;
background-color: #64beeb;
border-radius: 50%;
float: right;
}
.icon {
font-size: 1.75rem;
color: #fff;
}
HTML:
<div class="feature">
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
</div>
CODEPEN DEMO

add this to .circle and remove float:right; Then it will be absolutely positioned from the parent relative container.
position: absolute;
top: 10px;
right: 10px;
.feature {
position: relative;
border: 1px solid #000;
}
.circle {
position: absolute;
top: 10px;
right: 10px;
height: 2.5rem;
width: 2.5rem;
background-color: #64beeb;
border-radius: 50%;
}
.icon {
font-size: 1.75rem;
color: #fff;
}
<div class="feature">
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
</div>
And you could add padding-right: 50px; to .feature so the icon (blueih circle) will not be over text. See here https://jsfiddle.net/ymzofeph/

One option is to use flexbox. You can add display: flex to the container (.feature). Add flex: 1 to the text. To create some space around the icon you can use a margin value you find suitable.
.feature {
position: relative;
border: 1px solid #000;
/* for demo */
text-align: right;
display: flex;
}
.text {
flex: 1;
}
.circle {
height: 2.5rem;
width: 2.5rem;
background-color: #64beeb;
border-radius: 50%;
margin: 1rem;
}
.icon {
font-size: 1.75rem;
color: #fff;
}
<div class="feature">
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
</div>

<div class="feature">
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
</div>
<style>
.circle{
float:right;
width:40px;
height:40px;
margin:0 0 0 20px;
}
.text{
overflow:hidden;
}
</style>

Put the float:right div before the .text-right div. Then add padding-right:2.5rem; to the .text-right div.
Example

Related

css for chat room speech bubble position

Hello I am trying to design a chat room and am stuck on the css of speech bubbles.
What I want
Blue speech bubbles on the right and grey ones on the left.
At the moment
I tried several answers I found on SO like position relative/absolute. But none of the answers worked for me. If someone can help me here itd be great.
Html
<div class="card-body p-3 pt-0">
<div class="my-1 rounded-lg ">
<div class="position-relative w-100">
#foreach ($chats as $chat)
<p class="text-xs">
{{$chat->created_at}} # {{$chat->name}}
</p>
<div class="border-0 {{ $chat->user_identifier == 'SELF' ? 'chat-bubble-send' : 'chat-bubble-receive' }}">
<p class="text-sm ">
{{ $chat->message }}
</p>
</div>
#endforeach
</div>
</div>
</div>
Css
.chat-bubble-receive p {
background: #42a5f5;
color: #fff !important;
border-radius: 20px 20px 3px 20px;
display: block;
max-width: 75%;
padding: 7px 13px 7px 13px;
}
.chat-bubble-send p {
background: #f1f1f1;
color: #000 !important;
border-radius: 20px 20px 20px 3px;
display: block;
max-width: 75%;
padding: 7px 13px 7px 13px;
position: absolute;
left: 0;
}
.card-body {
flex: 1 1 auto;
padding: 1rem 1rem;
}
When the message is short
Chat messages using CSS Flex
Inside a flex parent, to determine the left/right position of the message elements — use margin-(left/right) set to auto
When using position:absolute make sure to use position:relative; (or any other position other than static) on a parent element.
Use bottom: 100% to position the absolute time details on top of the first message.
"Hide" display:none; by default the "name+datetime" pseudo element, but show it display:block; only for the first message in group by using :first-child and the + next sibling combinator selector
You could use the data-* attribute to store the extra details (time etc) and use a pseudo element like ::before to than populate it with that value using content: attr(data-time)
/* QuickReset */ * {margin: 0; box-sizing: border-box;}
.chat {
--rad: 20px;
--rad-sm: 3px;
font: 16px/1.5 sans-serif;
display: flex;
flex-direction: column;
padding: 20px;
max-width: 500px;
margin: auto;
}
.msg {
position: relative;
max-width: 75%;
padding: 7px 15px;
margin-bottom: 2px;
}
.msg.sent {
border-radius: var(--rad) var(--rad-sm) var(--rad-sm) var(--rad);
background: #42a5f5;
color: #fff;
/* moves it to the right */
margin-left: auto;
}
.msg.rcvd {
border-radius: var(--rad-sm) var(--rad) var(--rad) var(--rad-sm);
background: #f1f1f1;
color: #555;
/* moves it to the left */
margin-right: auto;
}
/* Improve radius for messages group */
.msg.sent:first-child,
.msg.rcvd+.msg.sent {
border-top-right-radius: var(--rad);
}
.msg.rcvd:first-child,
.msg.sent+.msg.rcvd {
border-top-left-radius: var(--rad);
}
/* time */
.msg::before {
content: attr(data-time);
font-size: 0.8rem;
position: absolute;
bottom: 100%;
color: #888;
white-space: nowrap;
/* Hidden by default */
display: none;
}
.msg.sent::before {
right: 15px;
}
.msg.rcvd::before {
left: 15px;
}
/* Show time only for first message in group */
.msg:first-child::before,
.msg.sent+.msg.rcvd::before,
.msg.rcvd+.msg.sent::before {
/* Show only for first message in group */
display: block;
}
<div class="chat">
<div data-time="16:35" class="msg sent">Hi!<br>What's up?</div>
<div data-time="Anna 16:36" class="msg rcvd">Hi dear! <br>Doing some CSS research, you?</div>
<div data-time="16:38" class="msg sent">Also learning some cool CSS stuff 🦄</div>
<div data-time="16:38" class="msg sent">!!</div>
<div data-time="16:38" class="msg sent">Up for a coffee today? ☕</div>
<div data-time="Anna 16:40" class="msg rcvd">It would be a pleasure!</div>
<div data-time="Anna 16:40" class="msg rcvd">😍</div>
</div>
I suggest using flex magic with a new row-div wrapping every bubble.
.row:nth-of-type(2n) {
display: flex;
justify-content: flex-end;
}
.bubble {
display: inline-block;
padding: 5px;
}
<div class="page-wrapper">
<div class="bubble-wrapper">
<div class="row">
<div class="bubble">
<p>First bubble</p>
<small>Details</small>
</div>
</div>
<div class="row">
<div class="bubble">
<p>Second bubble</p>
<small>Details</small>
</div>
</div>
<div class="row">
<div class="bubble">
<p>Third bubble</p>
<small>Details</small>
</div>
</div>
<div class="row">
<div class="bubble">
<p>Fourth bubble</p>
<small>Details</small>
</div>
</div>
</div>
</div>

Why doesn't the position work properly in the section

I have a section part on the website where I want four products being displayed in the middle, right and left arrows on both sides of the screen and a title in the middle above the displayed products, I think I have all of the HTML and CSS good but the position isn't working properly, can someone have a look and help me feature it out?img of the sections I am talking about
ps: the background color doesn't feel the space that the items and buttons are in, why does it happens too?
edit: this is a pic of how i wish it would look
HTML:
<section class="one">
<div><span class="title">New products</span></div>
<br>
<button class="left">
<span class="Lmain"></span>
<span class="Lside"></span>
</button>
<div class="items">
<div class="item">
<a href="">
<img class="itemImg" src="../Images/Image1.png" alt="Picture of the product">
</a>
<div><span class="desc">Description about that specific item that is being showen to you above this text
right here</span></div>
</div>
<div class="item">
<a href="">
<img class="itemImg" src="../Images/Image2.png" alt="Picture of the product">
</a>
<div><span class="desc">Description about that specific item that is being showen to you above this text
right here</span></div>
</div>
<div class="item">
<a href="">
<img class="itemImg" src="../Images/Image3.png" alt="Picture of the product">
</a>
<div><span class="desc">Description about that specific item that is being showen to you above this text
right here</span></div>
</div>
<div class="item">
<a href="">
<img class="itemImg" src="../Images/Image4.png" alt="Picture of the product">
</a>
<div><span class="desc">Description about that specific item that is being showen to you above this text
right here</span></div>
</div>
</div>
<button class="right">
<span class="Rmain"></span>
<span class="Rside"></span>
</button>
</section>
CSS:
.title {
text-align: center;
position: absolute;
margin: auto;
border: 1px solid goldenrod;
font-size: 40px;
}
.one {
background-color: hotpink;
position: relative;
}
.two {
background-color: rgb(255, 0, 128);
}
/*items appearance*/
.items {
position: relative;
margin: auto;
}
.item {
border: 1px solid rgb(255, 170, 0);
float: left;
position: absolute;
top: 0px;
margin: 0px 8px;
left: 12%;
width: 350px;
height: auto;
}
.itemImg {
width: 100%;
height: auto;
}
/*end of item appearance*/
.right {
right: 0px;
top: 0px;
position: absolute;
}
.left {
left: 0px;
top: 0px;
position: absolute;
}
Utilize flexbox to make this layout easy:
body {
margin: 0;
background: #1a1a1a;
color: #fff;
font-family: sans-serif;
}
h1#title {
padding: 1rem;
text-align: center;
}
main {
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
#products {
display: flex;
justify-content: center;
align-items: flex-start;
margin: 0;
}
.product {
padding: 2rem 1rem;
background: #fff;
color: black;
margin: .5rem;
}
<body>
<h1 id="title">Items</h1>
<main>
<div class="arrow" id="arrow-left">←</div>
<div id="products">
<div class="product">
Product
</div>
<div class="product">
Product
</div>
<div class="product">
Product
</div>
<div class="product">
Product
</div>
</div>
<div class="arrow" id="arrow-right">→</div>
</main>
</body>
Here a list of problem I see:
the .title element is position:absolute, so it doesn't fill any space and other elements will position weirdly. Solution: remove position: absolute
the .title is a <span> element witch is an inline-element who doesn't behave like a block element (<div>, <p>, <h1>, etc.), so the text-align: center doesn't take effect. Solution: remove the span and give the .title class to the parent <div>
the left and right buttons should be wrapped in a <div> with position:relative
Here is a jsfiddle with the fixed code.
I didn't fix the image positioning because i think those will be positioned by js, anyhow it dipends by the images dimensions and is a very weak method. So I strongly suggest using flexbox that is widely supported by browsers.
You can follow the #yerme example or this guide on flexbox.

How to position cards

My question is how to position these cards on my website?
https://imgur.com/a/Ompfh
It would be easy if there isn't this half circles above them.
I have tried to create parent class="cards" and class="card" for each of 3 cards.
In css:
.cards { display: flex }
.card { width: 33.33% }
And set relative position to my background and absolute position to my half-circles but I want to do it without absolute and relative positions if it's possible.
.cards {
display: flex;
}
.card {
width: 33.33%;
color: #fff;
text-align: center;
}
.card p {
min-height: 80px;
padding: 0 39px 0 39px;
}
.strategy--logo {
position: absolute;
top: 383px;
left: 607px;
width: 96px;
height: 48px;
background-color: #5a471b;
border-top-right-radius: 48px;
border-top-left-radius: 48px;
}
.strategy {
margin-top: 135px;
background-color: #5a471b;
}
.crop--marketing {
margin-top: 135px;
background-color: #9fa374;
}
.risk--mgmt {
margin-top: 135px;
background-color: #666;
}
<div class="cards">
<div class="card">
<div class="strategy">
<div class="strategy--logo">
<img src="css/images/strategy-logo.png" alt="" />
</div>
<!-- /.strategy-/-logo -->
<h2>
</h2>
<p>
</p>
</div>
<!-- /.crop-/-marketing -->
</div>
<!-- /.card -->
<div class="card">
<div class="crop--marketing">
<img src="css/images/crop-logo.png" alt="" />
<h2>
</h2>
<p>
</p>
</div>
<!-- /.crop-/-marketing -->
</div>
<!-- /.card -->
<div class="card">
<div class="risk--mgmt">
<img src="css/images/arrow-logo.png" alt="" />
<h2>
</h2>
<p>
</p>
</div>
<!-- /.risk-/-mgmt -->
</div>
<!-- /.card -->
</div>
<!-- /.cards -->
Now I'm using absolute and relative but is there another way? Because when I resize my web browser the circles go away random ...
Are you trying to achieve this?
.card {
displaY: block;
float: left;
width: 33.33%;
text-align: center;
color: white;
font-family: 'Calibri';
}
.icon {
width: 50px;
height: 25px;
/*half of width*/
margin: auto;
display: block;
border-radius: 50px 50px 0 0;
}
.fa {
margin-top: 10px;
}
.text {
padding: 25px;
}
.strategy .text,
.strategy .icon {
background-color: #5c471c;
}
.crop .text,
.crop .icon {
background-color: #a0a175;
}
.risk .text,
.risk .icon {
background-color: #666666;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<div class="card strategy">
<div class="icon">
<i class="fa fa-area-chart" aria-hidden="true"></i>
</div>
<div class="text">
Our Strategy
</div>
</div>
<div class="card crop">
<div class="icon">
<i class="fa fa-pagelines" aria-hidden="true"></i>
</div>
<div class="text">
Crop Marketing
</div>
</div>
<div class="card risk">
<div class="icon">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</div>
<div class="text">
Commodity Risk Management
</div>
</div>
Is the main problem that when you use position your layout changes its position elsewhere?
If so, to use position property is ok if you make a few changes:
CSS
.strategy--logo {
position: absolute;
/* Remove this top parameter, use transform instead */
/* top:383px; */
/* Instead your value of a left use value of 50% and transform left
and right properties like it is changed below */
/* left: 607px; */
left: 50%;
transform: translate(-50%, -100%);
width: 96px; height: 48px;
background-color: #5a471b;
border-top-right-radius: 48px;
border-top-left-radius: 48px;
}
.strategy {
/* add position relative to a parent of strategy-logo */
position: relative;
margin-top: 135px;
background-color: #5a471b;
}
Then your code will stay in the same position even if you resize the screen.

Container in bootstrap grid responding correctly?

So I have 3 boxes that need to have a particular height and width and have set them within bootstrap as child elements. Looks good in full view as:
However, when the window resizes, the boxes shift to the left rather than float in the middle of that background graphic. Additionally, the header text (in yellow) loses its upper padding as:
Figured the "responsiveness" was taking over but cannot pinpoint it and am hoping some of you can help.
My HTML for these are:
<div class="container">
<div class="claimHead col-md-12">
<div class="submitHeader" style="margin-top: 60px; margin-bottom: 60px; margin-left: 30px;">
<h1 style="font-size: 36px;">Claim Submission Tool</h1>
<p style="font-size: 18px;">Filing claims has never been easier, it's a simple as 1, 2, 3</p>
</div>
<div id="stepsContainer">
<div class="col-md-4 stepsBox">
<div class="claimSteps" id="stepOne">
<p class="claimStepNumber">1</p>
<p class="claimStepTitle">step one</p>
<p class="claimStepText">Get started by entering your claim information in the fields below.</p>
</div>
</div>
<div class="col-md-4 stepsBox">
<div class="claimSteps" id="stepTwo">
<p class="claimStepNumber">2</p>
<p class="claimStepTitle">step two</p>
<p class="claimStepText">Next drag & drop or upload your documentation.</p>
</div>
</div>
<div class="col-md-4 stepsBox">
<div class="claimSteps" id="stepThree">
<p class="claimStepNumber">3</p>
<p class="claimStepTitle">step three</p>
<p class="claimStepText">Now you're ready to submit your claim and await reimbursement.</p>
</div>
</div>
</div>
</div>
</div>
And my css is:
#stepsContainer {
text-align: center;
}
.stepsBox {
padding-bottom: 60px;
}
.claimSteps {
padding-top: 40px;
width: 335px;
height: 285px;
background-color: #2dccd3;
color: #ffffff;
text-align: center;
}
.claimStepNumber {
font-size: 38px;
background-color: #ffffff;
color: #2dccd3;
width: 65px;
height: 65px;
border-radius: 50%;
margin-left: 135px;
}
.claimStepTitle {
color: #ffffff;
font-size: 18px;
}
.claimStepText {
text-align: center;
margin-left: 33.3%;
width: 33.3%;
}
Any ideas on what I can do here and where to check? Am also using Bootstrap 3 on top of this css, but I do not see where it is causing the boxes to shift left justified.
Thanks much.
Columns are floated to the left by default and because you're using a fixed height/width inside of the columns (.claimSteps), they have no choice but to align left once the medium column collapses since they cannot occupy 100% of the smaller viewport.
The heading alignment has to due primarily to your HTML structure.
Note that one area you should consider changing is the width of the box you're creating. It's too wide and starts to break/overflow because it's fixed. If you can reduce it, you should (my examples reflect this but can easily be changed back to your default width.)
The fixed size of the box also comes into play at around 400px. In the second example I made the box flexible so it works properly across all viewports. See examples 1 and 2 on viewports under 400px.
Here are a few examples that may help.
Example 1: Standard Setup
.submitHeader {
margin: 60px 0;
}
.submitHeader h1 {
font-size: 36px;
}
.submitHeader p {
font-size: 18px;
}
.claimSteps {
width: 285px;
height: 285px;
background-color: #2dccd3;
color: #ffffff;
text-align: center;
position: relative;
margin: 0 auto;
display: table;
}
.claimStepNumber {
margin-top: 40px;
font-size: 38px;
background-color: #ffffff;
color: #2dccd3;
width: 55px;
height: 55px;
border-radius: 50%;
position: absolute;
display: table-cell;
left: 50%;
-webkit-transform: translate(-50%);
-ms-transform: translate(-50%);
transform: translate(-50%);
}
.claimStepTitle {
color: #ffffff;
font-size: 18px;
margin-top: 110px;
}
.claimStepText {
text-align: center;
margin-left: 33.3%;
width: 33.3%;
}
#media (min-width: 1200px) {
.submitHeader {
margin: 60px 40px;
}
}
#media (max-width: 991px) {
.claimSteps {
margin: 30px auto;
}
.submitHeader {
margin-top: 60px;
margin-bottom: 0;
text-align: center;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="submitHeader">
<h1>Claim Submission Tool</h1>
<p>Filing claims has never been easier, it's a simple as 1, 2, 3</p>
</div>
<div class="row">
<div class="col-md-4">
<div class="claimSteps" id="stepOne">
<p class="claimStepNumber">1</p>
<p class="claimStepTitle">step one</p>
<p class="claimStepText">Get started by entering your claim information in the fields below.</p>
</div>
</div>
<div class="col-md-4">
<div class="claimSteps" id="stepTwo">
<p class="claimStepNumber">2</p>
<p class="claimStepTitle">step two</p>
<p class="claimStepText">Next drag and drop or upload your documentation.</p>
</div>
</div>
<div class="col-md-4">
<div class="claimSteps" id="stepThree">
<p class="claimStepNumber">3</p>
<p class="claimStepTitle">step three</p>
<p class="claimStepText">Now you're ready to submit your claim and await reimbursement.</p>
</div>
</div>
</div>
</div>
Example 2: Mobile First Setup
.submitHeader {
margin: 60px 0;
}
.submitHeader h1 {
font-size: 36px;
}
.submitHeader p {
font-size: 18px;
}
.claimSteps {
width: 285px;
height: 285px;
background-color: #2dccd3;
color: #ffffff;
text-align: center;
position: relative;
margin: 0 auto;
display: table;
}
.claimStepNumber {
margin-top: 40px;
font-size: 38px;
background-color: #ffffff;
color: #2dccd3;
width: 55px;
height: 55px;
border-radius: 50%;
position: absolute;
display: table-cell;
left: 50%;
-webkit-transform: translate(-50%);
-ms-transform: translate(-50%);
transform: translate(-50%);
}
.claimStepTitle {
color: #ffffff;
font-size: 18px;
margin-top: 110px;
}
.claimStepText {
text-align: center;
margin-left: 33.3%;
width: 33.3%;
}
#media (min-width: 1200px) {
.submitHeader {
margin: 60px 40px;
}
}
#media (max-width: 991px) {
.claimSteps {
margin: 30px auto;
}
.submitHeader {
margin-top: 60px;
margin-bottom: 0;
text-align: center;
}
}
#media (max-width: 400px) {
/*Color For Demo Only*/
body {
background: red;
}
.claimSteps {
width: 100%;
height: 100%;
padding-bottom: 40px;
}
}
/*Color For Demo Only*/
#media (max-width: 320px) {
body {
background: lightblue;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="submitHeader">
<h1>Claim Submission Tool</h1>
<p>Filing claims has never been easier, it's a simple as 1, 2, 3</p>
</div>
<div class="row">
<div class="col-md-4">
<div class="claimSteps" id="stepOne">
<p class="claimStepNumber">1</p>
<p class="claimStepTitle">step one</p>
<p class="claimStepText">Get started by entering your claim information in the fields below.</p>
</div>
</div>
<div class="col-md-4">
<div class="claimSteps" id="stepTwo">
<p class="claimStepNumber">2</p>
<p class="claimStepTitle">step two</p>
<p class="claimStepText">Next drag and drop or upload your documentation.</p>
</div>
</div>
<div class="col-md-4">
<div class="claimSteps" id="stepThree">
<p class="claimStepNumber">3</p>
<p class="claimStepTitle">step three</p>
<p class="claimStepText">Now you're ready to submit your claim and await reimbursement.</p>
</div>
</div>
</div>
</div>
Example 3: Text Alignment Example
.claimSteps {
width: 285px;
height: 285px;
background-color: #2dccd3;
color: #ffffff;
margin-top: 30px;
margin-bottom: 30px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<h1>Claim Submission Tool</h1>
<p>Filing claims has never been easier, it's a simple as 1, 2, 3</p>
<div class="row">
<div id="stepsContainer">
<div class="col-md-4">
<div class="claimSteps"></div>
</div>
<div class="col-md-4">
<div class="claimSteps"></div>
</div>
<div class="col-md-4">
<div class="claimSteps"></div>
</div>
</div>
</div>
</div>
You should add class="row" before using the class="col-**-**" as common after class="container".
Have you tried separating your col-md-12 from those three stepBox's?
I don't see it necessary to wrap those columns inside the first column, so I would just rather end the col-md-12 before the #stepsContainer begins.
Another thing is that clearly your CSS limits the width of the claimSteps to be less than the screen width is when the md break-point occurs. You should in at least this point change the width property in CSS with media query.
#media (max-width: 1199px)
{
.claimSteps { width: 100%; }
}
That should do it.
Default div display as block, so it float to left, if you want set it float to the middle, you must set his display to inline-block and set container text-align to center
in your case you can add inline-block display to the .claimSteps CSS rules
.claimSteps {
padding-top: 40px;
width: 335px;
height: 285px;
background-color: #2dccd3;
color: #ffffff;
text-align: center;
display: inline-block;
}
For header, you can use padding instead of margin in div.submitHeader
See snippet for full result
#stepsContainer {
text-align: center;
}
.stepsBox {
padding-bottom: 60px;
}
.claimSteps {
padding-top: 40px;
width: 335px;
height: 285px;
background-color: #2dccd3;
color: #ffffff;
text-align: center;
display: inline-block;
}
.claimStepNumber {
font-size: 38px;
background-color: #ffffff;
color: #2dccd3;
width: 65px;
height: 65px;
border-radius: 50%;
margin-left: 135px;
}
.claimStepTitle {
color: #ffffff;
font-size: 18px;
}
.claimStepText {
text-align: center;
margin-left: 33.3%;
width: 33.3%;
}
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="claimHead col-md-12">
<div class="submitHeader" style="padding-top: 60px; padding-bottom: 60px; padding-left: 30px;">
<h1 style="font-size: 36px;">Claim Submission Tool</h1>
<p style="font-size: 18px;">Filing claims has never been easier, it's a simple as 1, 2, 3</p>
</div>
<div id="stepsContainer">
<div class="col-md-4 stepsBox">
<div class="claimSteps" id="stepOne">
<p class="claimStepNumber">1</p>
<p class="claimStepTitle">step one</p>
<p class="claimStepText">Get started by entering your claim information in the fields below.</p>
</div>
</div>
<div class="col-md-4 stepsBox">
<div class="claimSteps" id="stepTwo">
<p class="claimStepNumber">2</p>
<p class="claimStepTitle">step two</p>
<p class="claimStepText">Next drag & drop or upload your documentation.</p>
</div>
</div>
<div class="col-md-4 stepsBox">
<div class="claimSteps" id="stepThree">
<p class="claimStepNumber">3</p>
<p class="claimStepTitle">step three</p>
<p class="claimStepText">Now you're ready to submit your claim and await reimbursement.</p>
</div>
</div>
</div>
</div>
</div>

HTML, CSS: Append inline-element to the right of a centered inline-element

(The title might sound stupid but I don't know how to put it more sophisticated.)
As you can see in the follwing screenshots, I have 3 stacked divs.
<div class="col-xs-3">
<div class="center-horizontal-inline">
<a class="upvote" href="#" data-id="iZheLNnewWtMhPTQd">
</div>
<div class="score">
115
<span class="badge score-diff vertical-align"> +5 </span>
</div>
<div class="center-horizontal-inline">
</div>
The one in the middle contains the number (115). The other two the vote-arrows. For the one containing the number, I want to add a "badge" (in bootstrap context) right next to the number, let's say to the right. You can see my attempt shining through the colored overlay.
The goal is to leave the number centered respectively to the arrow-icons, while placing the badge with an offset (or "right next to") respectively to the number.
My attempt was to set a float: right; for the badge, but as you can see, the number has an offset now. When I try position: absolute; on the badge, there is no offset (as wanted), but I can't get the badge right next to the number, I can only attach it to the right border because I don't have the number as positioning-reference anymore.
Hope my explanation was clear enough. I also didn't know how to search for that problem...
EDIT 1:
As I want it to look like (positioning-wise):
Here we go, using relative and absolute positions together:
DEMO: http://jsfiddle.net/1qbo7uwn/
HTML
<div class="score">
<span class="score-wrap">
<span class="score-main">123</span>
<span class="score-diff">8</span>
</span>
</div>
CSS
.score {
width: 80px;
border: 2px solid blue;
padding: 10px 0;
text-align: center;
}
.score-wrap {
display: inline-block;
position: relative;
}
.score-main {
border: 2px solid green;
}
.score-diff {
position: absolute;
border: 2px solid red;
left: 100%;
top: -2px;
}
Added some span tags in the HTML.
EDIT: vertical align of everything, by setting line height.
http://jsfiddle.net/1qbo7uwn/1/
As you said you are okay with HTML modification. Here's my attempt:
Demo Fiddle
HTML
<div class="wrap">
<div class="vote up">
<i class="fa fa-angle-up"></i>
</div>
<div class="stat">
<span class="score">115
<span class="badge">+5</span>
</span>
</div>
<div class="vote inactive">
<i class="fa fa-angle-down"></i>
</div>
</div>
CSS
.wrap{
margin: 100px;
text-align:center;
}
.vote{
font-size:36px;
}
.up{
color:green;
}
.down{
color:red;
}
.inactive{
color:gray;
}
.score{
position: relative;
display:block;
padding: 5px 0;
}
.badge{
background: #eee;
padding:5px 10px;
border-radius: 30px;
position: absolute;
top:0;
margin-left:10px;
}
Try
Demo: http://jsfiddle.net/tamilcselvan/rjv1xxo2/1/
.center-horizontal-inline {
font-size: 2em;
text-align: center;
}
.score {
text-align: center;
}
.score:after {
content:attr(data-badge);
position: absolute;
margin-left: .4em;
font-size: x-small;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: 700;
line-height: 1;
color: #FFF;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
background-color: #777;
border-radius: 10px;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-xs-3">
<div class="center-horizontal-inline vote"> <i class="glyphicon glyphicon-chevron-up"></i>
</div>
<div class="score" data-badge="+5">115</div>
<div class="center-horizontal-inline"> <i class="glyphicon glyphicon-chevron-down"></i>
</div>
</div>