CSS - making symbol stay always on second line - html

I want to that symbol -> (text element) would only appear in second line. For example if text would be one line
John
->
and if there would be two lines of text symbol would still be on second line.
John and
Tom ->
is it possible?
Currently how it is:
HTML
<div class="inner-box">
<span class="inner-box-text">Category<i class="icon-font icon-long-arrow"></i></span>
</div>
CSS
.inner-box {
bottom: 16%;
left: 10%;
right: 25%;
text-align: left;
position: absolute;
z-index: 3;
height: 51px;
}
.inner-box span {
display: inline-block;
text-align: left;
text-transform: uppercase;
text-decoration: none;
color: white;
line-height: 25px;
max-width: 270px;
padding-right: 5px;
}
.inner-box i {
padding-top: 5px;
}

first of all the span should be closed as well like so:
<div class="inner-box">
<span class="inner-box-text">Category<i class="icon-font icon-long-arrow"></i></span>
</div>
What you are likely looking for is CSS selector :after
<style>
.inner-box-text:after {
content: " --- whatever should come after";
}
</style>
Sadly the :after selector does not support HTML, only text.
Another possibility would be the use of jQuery to append something.
Alex

you can use below code
<div class="inner-box">
<span class="inner-box-text">Category</span><i class="icon-font icon-long-arrow"></i>
</div>
and below css
.vip-inner-box {
bottom: 16%;
left: 10%;
right: 25%;
text-align: left;
position: absolute;
z-index: 3;
height: 51px;
span {
display: inline-block;
text-align: left;
text-transform: uppercase;
text-decoration: none;
font: $font-weight-light 24px $font-custom;
color: white;
line-height: 25px;
max-width: 270px;
padding-right: 5px;
}
}
i {
padding-top: 5px;
display:block;
}

Related

How can i put the <p> tag infront of the <progressbar> tag

I wanted to do some UI-Design and came across a little problem. Basically the tag should be the background of that tag -which is only red so that it can be found more easily-.
screenshot
HTML-Code:
<div class="tournament">
<p>
<GET system.template.tournament.date> <progress id="value" max="8"></progress>
</p>
<button>Information</button>
</div>
<p class="playerNumber">
<span id="players">4</span>/<span id="max">8</span> <span id="plural">Players</span> in
</p>
CSS-Code:
.tournament {
background-color: #202020;
width: 98%;
margin-left: 1%;
margin-top: 15px;
height: 121px;
}
.tournament p {
text-align: left;
position: absolute;
margin-top: 48px;
margin-left: 20px;
}
.tournament button {
margin-left: 90%;
margin-top: 43px;
border-radius: 100px;
width: 135px;
height: 35px;
border-color: #666666;
}
.tournament progress {
border-color: #666666;
background-color: #202020;
width: 285%;
height: 45px;
position: absolute;
margin-top: -10px;
margin-left: 80%;
}
progress::-moz-progress-bar { background: #151515; }
progress::-webkit-progress-value { background: #151515; }
progress { color: #151515; }
.playerNumber {
text-align: left;
color: red;
margin-left: 30%;
margin-top: -50px;
z-index: 200;
}
Basically that p-element shows some information related to that progressbar. In this case it says "4/8 Players in" which is refered to the tournament. Thats why the progressbar is 50%-full.
Its not a problem if you have a solution that comes without a -tag but allowes me to write something on the progressbar.
Why am i asking here?
z-index didnt solve my problem as you can see in the code
I didnt found an answer to my problem on this forum
Google had no clue either
you need to put the .playerNumber element inside the .tournament element.
just adjust the positions using, top, left css props for .playerNumber element...
then you would need this css and...
.playerNumber {
text-align: left;
color: red;
left: 300px;
top: 10px;
z-index: 3;
display:block;
}
.tournament progress {
border-color: #666666;
background-color: #202020;
width: 285%;
height: 45px;
position: absolute;
margin-top: -10px;
margin-left: 0px;
z-index: 2;
}
...and html like this
<div class="tournament">
<p>
<GET system.template.tournament.date> <progress id="value" max="8"></progress>
</p>
<button>Information</button>
<p class="playerNumber">
<span id="players">4</span>/<span id="max">8</span> <span id="plural">Players</span> in
</p>
</div>
test here

HTML Code for a short horizontal line centered next to certain text

I'm looking for the HTML code to create a short horizontal line centered inline with text (in a particular typeface) like the image.
Currently, the code I have is:
<span style="font-family:'Taner Ardali Antikor Mono Medium';">MY MISSION</span>
Note: I'm using this code for a text markdown or code block on my Squarespace site. I'm unfamiliar with coding, so not sure if that makes a difference.
You can use :after selector for this
.title {
font-family:'Taner Ardali Antikor Mono Medium';
font-size: 30px;
display: block;
}
.title:after {
content:"";
display: inline-block;
height: 2px;
width: 100px;
margin-left: 10px;
background: #111;
vertical-align: super;
}
<span class="title">MY MISSION</span>
Or It is possible to change HTML use heading tag like this:
.title {
font-family:'Taner Ardali Antikor Mono Medium';
font-size: 30px;
display: block;
position: relative;
}
.title span {
background: #fff;
position: relative;
z-index: 1;
padding-right: 20px;
}
.title:after {
content:"";
display: inline-block;
height: 2px;
width: 100%;
margin-left: 10px;
background: #111;
position: absolute;
left: 0;
top: 15px;
}
<h2 class="title"><span>MY MISSION</span></h2>

CSS: Progress bar, second background is appearing below bar instead of overlapping

I'm trying to create a Progress Bar. If user has completed 20%, a bar with my set colour is being created with the correct width. But for some reason, its appearing below my progress bar instead of overlapping and I have no idea why.
Bonus question: Any ideas why text is not aligned to center?
CSS:
.progress-bar {
height: 20px;
width: 126px;
background: #BABABA;
position: relative;
}
.progress-bar span {
font-size: 1.1rem;
font-weight: 600;
line-height: 15px;
text-align: center;
position: relative;
}
.progress-bar div.bar {
height: 20px;
background: #336291;
position: absolute;
}
EJS:
<td>
<div class="progress-bar">
<span><%= gamedata[i].progressPercentage %></span>
<div class="bar" style="width:<%= gamedata[i].progressPercentage %>;"></div>
</div>
</td>
You should put the correct coordinates, so append the following lines:
.progress-bar div.bar {
/* your code here */
top: 0;
left: 0;
}
Bonus answer: your text is aligned in the center but your DOM element is not. What I suggest doing is giving automatic lateral margin and treating it as a block, like so:
.progress-bar span {
font-size: 1.1rem;
font-weight: 600;
line-height: 15px;
display: block;
margin: auto;
position: relative;
}
try this code nothing big changes. Some small changes in css and HTML.
.progress-bar {
height: 20px;
width: 126px;
background: #BABABA;
position: relative;
}
.progress-bar span {
font-size: 1.1rem;
font-weight: 600;
line-height: 15px;
text-align: center;
position: relative;
}
.progress-bar div.bar {
height: 20px;
background: #336291;
position: absolute;
}
Hear is html code:
<td>
<div class="progress-bar">
<div class="bar" style="width:<%= gamedata[i].progressPercentage %>;">
<center><%= gamedata[i].progressPercentage %></center>
</div>
</div>
</td>

horizontal white space between div tags

Can anyone please let me know why the following code produces white space between the div "content-main', and the two introduction divs, which sit above the main content?
.header {
width: inherit;
background-color: #58614E;
height: 8em;
position: relative;
z-index: 2;
}
.header-logo {
float: left;
display: inline-block;
}
#header-home-link {
color: white;
font-weight: bold;
margin-left: 3em;
position: relative;
top: 1em;
}
.header a:link {
color: #C5EBF9;
position: relative;
top: 1em;
padding-left: 1em;
}
.introduction-left {
background-color: #EEEEEE;
width: 55%;
padding-bottom: 1em;
padding-right: 1.0em;
padding-top: 1em;
border-right-style: dotted;
border-right-width: 1px;
float: left;
overflow: auto;
}
.introduction-left h2 {
color: #57614E;
padding-left: 13em;
}
.introduction-left p {
color: #626262;
padding-left: 2.0em;
z-index: 2;
}
.introduction-right {
background-color: #EEEEEE;
width: 40%;
float: right;
z-index: 0;
padding-right: 3.3em;
padding-top: 2em;
padding-bottom: 3.7em;
}
.introduction-right h2 {
color: #57614E;
font-style: italic;
position: relative;
left: 3em;
bottom: 0.5em;
margin: 0;
}
.introduction-right p {
padding-left: 1em;
color: #57614E;
}
.content-main {
background-color: #E2E2E2;
border-style: solid;
border-width: 1em;
border-color: white;
width: 100%;
overflow: auto;
}
.content-main h3 {
color: #728063;
font-style: italic;
padding-left: 15em;
}
<div class="header">
</div>
<div class="introduction-left">
<h2>Today's News</h2>
<p>This website template has been designed by Free Website Templates for you, for free. You can replace all this text with your own text. You can remove any link to our website from this website template, you're free to use this website template without
linking back to us. If you're having problems editing this website template, then don't hesitate to ask for help on the Forums.</p>
</div>
<div class="introduction-right">
<h2>Testimonials</h2>
<p>"You can remove any link to our website from this website template, you're free to use this website template without linking back to us.”
</p>
</div>
<div class="content-main">
<h3>Main Articles.</h3>
</div>
I think because,you use
.content-main{
border-style: solid;
border-width: 1em;
Try to use
.content-main{
background-color: #E2E2E2;
border-style: none;
width: 100%;
overflow:auto;
In your css, I see (last Chrome in Linux)
when I use border-style: none, I get (second div with main-context without space):
It's what you want?
Quick answer - not necessarily right:
Try removing all padding statements in CSS temporarily and see how it looks...
Then add them back in as desired.
The spaces between your elements are causing the white space to appear. Put in some sort of wrapper and give it font-size: 0, then give the divs with text a font-size: initial, or if you care about making it IE compatible give it font-size: 16px or whatever, since font-size: initial doesn't work on IE.

vertical-align:middle for a span element

I am trying to get the text in a span to align vertically in the middle relative to adjacent text. This is easily achieved, however when the text in the span takes up two lines, the text is cut-off.
To solve this problem the span either needs to expand in height when the text takes up two lines, or to somehow align the text to the middle..
A working example of the problem is here http://jsfiddle.net/BxLnN/
Any suggestions or solutions would be greatly appreciated.
The current dimensions of the containing elements must remain the same.
Cheers!
the html
<div class="divisions_container">
<div class="division">
<div class="div_head">
DIVISION 1 <span>SIX WINNING NUMBERS</span>
</div>
<div class="div_head">
DIVISION 2
<div>
<span>FIVE WINNING NUMBERS PLUS ONE OF THE TWO SUPPLEMENTARY NUMBERS</span>
</div>
</div>
</div>
</div>
the css
/* division winnings */
.divisions_container {
font-size: 13px;
padding: 0 10px;
width: 7.4cm;
height: 8.5cm;
}
.div_head {
margin-top: 20px;
text-align: left;
padding-left: 5px;
position: relative;
background-color: #000;
color: #fff;
max-height: 6mm;
font-weight: bold;
font-size: 1.2em;
}
/* # winning numbers */
.div_head span {
font-size: 0.5em;
vertical-align: middle;
font-weight: 200;
border: 1px solid red;
display: inline-block;
position: absolute;
right: 0;
top: 0;
bottom: 0;
left: 100px;
}
You have got the span with position: absolute;. When you make an element absolutely positioned, it becomes a block element without any margins, and you cannot use vertical-align on them, as it works only on inline and inline-block elements.
So I suggest this CSS:
/* division winnings */
.divisions_container {
font-size: 13px;
padding: 0 10px;
width: 7.4cm;
height: 8.7cm;
}
.div_head {
margin-top: 20px;
text-align: left;
padding-left: 5px;
position: relative;
background-color: #000;
color: #fff;
max-height: 6mm;
font-weight: bold;
font-size: 1.2em;
}
/* # winning numbers */
.div_head span {
font-size: 0.5em;
vertical-align: middle;
font-weight: 200;
border: 1px solid red;
display: inline-block;
}
.div_head div {position: absolute;
right: 0;
top: -2px;
bottom: 0;
left: 100px;
}
Fiddle: http://jsfiddle.net/praveenscience/BxLnN/1/
If it's possible for you to set a fixed height to your span, like 20px or so, then you could use: line-height: 20px in your .div_head span style. That would then center the text in your span automatically.
You also don't need to set a display: inline-block and vertical-align: middle that way.
Example: http://jsfiddle.net/BxLnN/2/
Try this works...
You must specify width of span and position to relative and increase or decrease the value of top and left;
.div_head span {
font-size: 0.5em;
vertical-align: middle;
font-weight: 200;
border: 1px solid red;
display: inline-block;
position: relative;
right: 0;
top: -20px;
bottom: 0;
left: 100px;
text-align: left;
width: 200px;
}
Try this works...
You must specify width of span and position to relative and increase or decrease the value of top and left;
.div_head span {
font-size: 0.5em;
vertical-align: middle;
font-weight: 200;
border: 1px solid red;
display: inline-block;
position: relative;
right: 0;
top: -20px;
bottom: 0;
left: 100px;
text-align: left;
width: 200px;
}
The Nice One Is Here
HTML
<div class="Division_Container">
<span>Division 1</span>
<span class="Inner_Container">
six winning numbers
</span>
</div>
<div class="Division_Container">
<span>Division 2</span>
<span class="Inner_Container">
five winning numbers and rest of the nubmers to be displayede winning numbers and rest of the nubmers to be displayed
</span>
</div>
<div class="Division_Container">
<span>Division 2</span>
<span class="Inner_Container">
five winning numbers and rest of the nubmers to be displayede winning n
</span>
</div>
CSS
.Division_Container{display: block; width: 300px; background: #000; color: #fff; margin: 10px;}
.Inner_Container{display: inline-block; vertical-align: middle; left: 200px; width: 200px; margin-left: 20px; border: 1px solid red;}
/* If you want to specify height add following */
.Division_Container:before{content: "."; display: inline-block; height: 100px; vertical-align: middle; visibility: hidden;}