Show text in vertical format - html

<span class="helpBtn">HELP</span> help text should stay inside span
It should display like this......
I have tried text transform but it isn't giving me correct solution.
Actually i don't want to change text inside span. It should stay inside span like i have shown. It shouldn't be edited.

Try breaking word in css. If you need more spacing and your words are breaking each 2 or more letters use letter-spacing or just padding.
CSS:
.wrapper {
position: fixed;
background-color: green;
top: 30px;
left: 0;
width: 20px;
border-radius: 0 10px 10px 0;
color: white;
font-size: 13px;
padding: 5px;
word-wrap: break-word;
}
HTML:
<div class="wrapper">
HELP
</div>
https://fiddle.jshell.net/1hwd5j7g/

try below code. it would definitely help you.
<div class="vertical-text">Hello Vertical Texter!</div>
<style>
.vertical-text {
background: #e23737 none repeat scroll 0 0;
border: 1px solid #b52c2c;
box-shadow: 2px -2px 0 rgba(0, 0, 0, 0.1);
color: #fff;
float: left;
margin-left: 40px;
padding: 10px;
text-transform: uppercase;
transform: rotate(90deg);
transform-origin: left top 0;
}
</style>

with CSS:
<style>
h1 span { display: block; }
</style>
<h1>
<span> H </span>
<span> E </span>
<span> L </span>
<span> P </span>
</h1>
With Javascript:
<style>
h1 span { display: block; }
</style>
<h1><span> HELP </span></h1>
<script>
var h1 = document.getElementsByTagName('h1')[0];
h1.innerHTML = '<span>' + h1.innerHTML.split('').join('</span><span>') +'</span>';
</script>
Source: http://code.tutsplus.com/tutorials/the-easiest-way-to-create-vertical-text-with-css--net-15284

Related

How can I make a line after a heading with font awesome icon in the middle?

Am trying to do the same as the photo shows but I don't really know how to do that
So I should be able to have that line with any fontawesome icon in the middle.
Here my initial markup:
<h1>Welcome</h1>
h1 {
font-size: 25pt;
display: inline-block;
margin: 0;
font-weight: 300;
}
h1:after {
content: '\f209';
font-family: FontAwesome;
display: block;
}
Here my fiddle
Hope you can help.
By giving your h1 a border-bottom and positioning your :after icon absolute in the center inside it. Also apply a white background to make sure the line gets interrupted.
h1 {
font-size: 25pt;
display: inline-block;
margin: 0;
font-weight: 300;
padding-bottom: 10px;
border-bottom: 1px solid #000;
}
h1:after {
content: '\f209';
position: absolute;
font-family: FontAwesome;
background-color: #FFF;
display: block;
margin-left: 50px;
}
Update fiddle
Well... the accepted answer works fine, but it involves set widths, and will need to be rewritten to cater for longer text in the heading. The following works regardless of width of text (it does, however, involve a little bit more HTML):
https://jsfiddle.net/jx4dv11g/3/
h1 {
font-size: 25pt;
margin: 0 auto;
font-weight: 300;
padding-bottom: 10px;
border-bottom: 1px solid #000;
text-align: center;
display: inline-block;
}
.headericon {
display: inline-block;
position: absolute;
}
.headericon i {
display: block;
margin-top: -25%;
background: white;
transform: translate(-50%,0);
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<h1>Welcome to this page<br><span class="headericon"><i class="fa fa-hand-peace-o"></i></span></h1>
I'll suggest you to use following HTML structure for this:
<h1 class="styled-heading">
Welcome to HTML and CSS
<span class="fa fa-hand-peace-o"></span>
</h1>
Apply a class on h1 and use pseudo elements :before and :after to draw lines around icon.
This will allow you to have one time generic styling for all similar places in your web page. If you wants to use different icon in some other heading then all you need is just change the font awesome icon in that header.
body {
text-align: center;
margin: 0;
}
.styled-heading {
text-align: center;
font-size: 25pt;
display: inline-block;
margin: 0;
font-weight: 300;
position: relative;
overflow: hidden;
}
.styled-heading .fa {
display: block;
margin: 0 auto;
}
.styled-heading:before,
.styled-heading:after {
position: absolute;
background: black;
margin-left: 30px;
width: 999px;
height: 1px;
content: '';
bottom: 12px;
left: 50%;
}
.styled-heading:after {
margin-right: 30px;
margin-left: 0;
right: 50%;
left: auto;
}
.orange {
background: orange;
}
.green {
background: green;
}
.blue {
background: blue;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<h1 class="styled-heading">
Welcome to HTML and CSS
<span class="fa fa-hand-peace-o"></span>
</h1>
<div class="orange">
<h1 class="styled-heading">
Welcome To HTML and CSS.
<span class="fa fa-home"></span>
</h1>
</div>
<div class="blue">
<h1 class="styled-heading">
Welcome To HTML and CSS.
<span class="fa fa-globe"></span>
</h1>
</div>
<div class="green">
<h1 class="styled-heading">
Welcome To HTML and CSS.
<span class="fa fa-power-off"></span>
</h1>
</div>

text not rendering in div

I have following CSS:
#navigation {
background-color: #ededed;
text-align: center;
margin: 0;
font-size: 0;
}
#meet {
position: relative;
z-index: 1;
display: inline-block;
background-color: #088A85;
width: 300px;
height: 90px;
margin: 0;
padding: 0;
}
#meet p {
z-index: 3;
background-color: #000000;
text-align: center;
color:
}
#meet a, #develop a, #beinformed a{
color: #ffffff;
text-decoration: none;
}
.council {
background-image: url(council.png);
}
And following HTML code:
<div id="navigation">
<div id="meet">
<p>THIS TEXT IS NOT SHOWN</p>
<span class="button council">
council
</span>
<span class="button tacticalgroup">
tactical group
</span>
</div>
For some reason the text in the Paragraph is not shown. I have tried various things (z-index etc), but it is not working.
What am I missing here?
I forgot that I had put font-size to a value of 0 and that explains all why the text in the P is not shown. I have therefore set the font-size of the P element element to a higher value and that solves the problem.

The text goes over the image and not under it

The problem is that when I added an image to my html page,and I tried to write something to continue my working,the text was going over the image.I want the text to be going under the image.I don't want to use 50 "br" tags so that I can write under it.Do you know what's the problem guys ?
.poze {
max-width: 100%;
margin-top: 0.5em;
margin-bottom: 1em;
-webkit-box-shadow: rgba(0, 0, 0, 0.199219) 0px 0px 20px;
background: white;
border: 1px solid #CCC;
border-bottom-left-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
padding: 8px;
"
}
.cerculet {
display: block;
}
.cerculet:after {
display: block;
clear: both;
content:' ';
}
.cerculet p {
font-weight: bold;
}
.cerculet h2 {
font-size: 120%;
height: 145%;
width: 1.6em;
height: 1.6em;
text-align: center;
border-radius: 50%;
background-color: black;
color: white;
white-space: nowrap;
float: left;
margin-right: 15px;
}
That was the CSS.Now I'll post the html code:
<h2>
<div class="cerculet">
<h2>2 </h2>
<p>
<font size="5" face="Cambria">
Gripa Spaniola (1918 - 1919):<br>
A ucis intre 50 si 100 de milioane de oameni din intreaga<br>
lume in mai putin de 2 ani
</font>
</p>
</div>
</h2>
<br>
<img src="http://s6.postimg.org/6oyuxe1e9/Spanish_Flu.jpg" class="poze" style="position:absolute; left:150px;">
<div>
<h1>
As you can see,the text doesn't go under my image.How to fix this problem guys?
</h1>
</div>
I hope you'll understand the code.I mean,I used that "4 spaces indent" or whatever and I don't know if that's the right way to post the code.If I copy/paste all,it won't show it right..
https://jsfiddle.net/9hw89uog/
Remove position:absolute from your image styles, it is an inline style in your case
Here is one solution: https://jsfiddle.net/73s1c4h1/2/
<div class="clearfix">
<img src="https://images.nga.gov/images/bindo.jpg" class="poze"style="margin-left:150px;">
<div>
<h1 >
Now the text should be clear of the image and positioned below it.
</h1>
</div>
</div>
This involves using the all famous "clearfix" CSS solution. You will need to wrap the image and text in a div, then place class="clearfix" in that div. The clearfix CSS is here: https://css-tricks.com/snippets/css/clear-fix/
It will force the div element to clear the children elements.
Clearfix CSS:
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content:" ";
clear: both;
height: 0;
}
* html .clearfix { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */
The second solution is a bit simpler; just set position: relative; rather than absolute. https://jsfiddle.net/73s1c4h1/1/
You may also need to change left: 150px to margin-left: 150px

Button with a bigger text centering issue

I´m trying to do some buttons with image and text, and I already did this work.
But now I´m studying a diferente hypothesis, If I have a text bigger I´m trying to center the text in the button but I´m not having sucess put this right. I´m not having succeess putting my very big is not good align-center just below the 1st text.
Have you ever had a case like this? How we can solve this?
I have this Html for two buttons:
<button class='btn'>
<img class="big_btn" src="icon1.png" width="40" height="40"/>
Big button so big <span> very big is not good</span>
</button>
<button class='btn'>
<img src="icon1.png" width="40" height="40">
2button big
</button>
And I have this css file:
.btn {
position: relative;
width: 180px;
height: 60px;
margin-top:7%;
padding: 0 10px 0 10px;
line-height: 37px;
text-align: left;
text-indent: 10px;
font-family: 'bariol_regularregular';
font-size: 15px;
color: #333;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
background: #f1f1f1; /* button background */
border: 0;
border-bottom: 2px solid #999; /* newsletter button shadow */
border-radius: 14px;
cursor: pointer;
-webkit-box-shadow: inset 0 -2px #999;
box-shadow: inset 0 -2px #999;
}
.btn:active {
top: 1px;
outline: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn img { float: left;}
.btn .big { margin-top:10px;}
.btn:hover { background-color: #f7f7f7;}
Here's the Fiddle: http://jsfiddle.net/3F9pu/
My image updated:
Your problem is your line-height attribute. If you set that to be 37px, each new line of text will be separated by 37px. Remove `line-height:37px and the text will wrap around the image.
line-height: 37px
I also removed your text-indent and replaced it with a margin on your floated image to make the text all align properly.
.btn img{
float:left;
margin-right: 10px;
}
text-indent: 10px
JSFiddle
Use a CSS background image.
Have a fiddle - Fiddle Link!
HTML
<button class='btn'>Big button so big very big is not good</button>
<button class='btn'>2button big</button>
CSS
.btn {
background: url("http://lorempixel.com/output/cats-q-c-40-40-3.jpg") #CCC 10px no-repeat;
border: none;
padding: 10px 10px 10px 60px;
width: 200px;
text-align: left;
vertical-align: top;
min-height: 60px;
cursor: pointer;
}
.btn:hover {
background-color: #F00;
}

CSS Tooltip has different position in different browsers. How can I account for this?

I have adjusted my bottom attribute to display how I want it in Firefox, but the spacing is all warped in Chrome and Safari. Is there a way to sett a different "top" attribute for each browser?
HTML
<a class="tooltip" href="#"> <!-- this tag activates my tool tip -->
<div class="handsevent" > <!-- this div contains everything that activates the tool tip when hovered over-->
<div class="handswrapper">
<div class="handshour" >
<h3>8:00am-noon</h3>
</div>
<div class="handsspeaker">
<h3>Speaker 3</h3>
</div>
</div>
<div class="handstitle">
<p>Description</p>
</div>
</div>
<span class="classic"> <!-- this span contains everything that pops up in the tool tip -->
<h3>Title Bar</h3>
<br />lots of descriptive text
</span>
</a>
CSS
/* HOVER WINDOW */
.tooltip {
color: #000000; outline: none; font-style:bold;
cursor: help; text-decoration: none;
position: relative;
}
.tooltip span {
margin-left: -999em;
position: absolute;
}
.tooltip:hover span {
border-radius: 30px 30px; -moz-border-radius: 30px; -webkit-border-radius: 30px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
font-family: Arial, Tahoma, Helvetica, sans-serif;
position: auto; left: 1em; top: 2em; z-index: 99; <!-- the 'top' attribute on this line is where I have been adjusting the display position it affects the position differently in different browsers -->
margin-left: 0; width: 700px; margin-top:-10px;
}
.tooltip:hover img {
border: 0; margin: -30px 0 0 90px;
float: right; position:fixed;
z-index: 99;
}
.tooltip:hover em {
font-family: Arial, Tahoma, Helvetica, sans-serif; font-size:14px; font-weight: bold; color:005DA4;
display: block; padding: -0.2em 0 0.6em 0;
}
.classic { padding: 0.8em 1em; }
* html a:hover { background: transparent; }
.classic {background: #ffffff; border: 1px solid #ffffff; }
I have tried pixels, em, and percentage. None of these have been consistent. Are there browser specific settings I could use?
here is a demo link for reference.
Using a CSS Reset will help to eliminate differences between browsers.
I switch the top attribute in ".tooltip:hover span" to "auto" and that seems to be working.