I am a complete newb with coding, and I'm running into a bit of trouble with some text on my website. The code I am using is as follows:
<p><div style="font-family:blog_script"><font size="7">Hi, We're <b>The Distance</b><p></p></font></p>
</a>
</div><p>
I would really appreciate any help with:
The spacing in between each line (I would like for the lines to be slightly further apart)
There is also a lot of empty space below the text creating a large gap between the HTML code and the normal text on the site, I would like to get rid of this.
See our website for a demo link.
I'd really appreciate any tips you can give me.
Thanks so much for your time.
<div style="font-family: blog_script; line-height: 1;">
<font size="7">Hi there, We're
<b>The Distance</b>
</font>
</div>
I have set line-height for the div. Try this. It worked for me.
You need to edit the associated style sheet for this. For a quick fix for problem 1, you can try putting new line between the lines -
Blockquote
"Hi, We're The < br> Distance"
Blockquote
You need to make a custom css class to manage any adjustments you need to do to a certain HTML element.
.more-height {
line-height: 1;
}
Add the class name to the class="... property of the "we are the distance" like this:
<div style="font-family: blog_script;" class="more-height">
This will make the distance between the lines a bit higher.
You can also inject the style of the div element above with the "line-height" property like this:
<div style="font-family: blog_script; line-height: 1;">
Let me know if this works.
See you could use line-height for reduce spacing. Like one I found on you site. Similarly as below you have to target parent element with different class and id and set his line-height accordingly.
#siteWrapper {
font-family: "Kameron",Georgia,serif;
font-weight: 400;
letter-spacing: 0px;
font-family: "Open Sans";
font-size: 16px;
line-height: 1.5em; /*Line height reduce this and adjust*/
letter-spacing: .4px;
font-weight: 300;
font-style: normal;
color: rgba(0,0,0,.5);
}
Check this simple example which helps you to understand how line-height and letter-spacing works jsFiddle
Related
I am having a very difficult time getting rid of this persistent 5px whitespace on my website eternalminerals.com
I highlighted it in this screenshot: http://s15.postimg.org/de4sjvqob/5pxwhitespace.png
In google chrome, if I edit the element to have a margin-top: -5px, it gets rid of the whitespace, but since I am using Avada shortcodes, I cannot attach this style to it since it is a shortcode:
<p style="text-align: center; margin-top: -10px; font-size: 19px !important; line-height: 42px !important; color: #FFE396!important; font-family: 'MuseoSlab500Regular', Arial, Helvetica, Sans-Serif;"><strong>That's my opinion. I am Dr George Lundberg, at large at The Eternal Minerals of Life.</strong></p>
</div>
[/raw]
[fullwidth backgroundcolor="#140100" backgroundimage="" backgroundrepeat="no-repeat" backgroundposition="top left" backgroundattachment="fixed" bordersize="0px" bordercolor="#e5e4e4" paddingTop="-5px" paddingBottom="0px"]
<br>
[ajax_load_more post_type="testimonials-widget" posts_per_page="5" pause="true" transition="fade" button_label="Click to show testimonials from real physicians"]
[/fullwidth]
As you can see, paddingTop="-5px" doesn't cut it. Does anyone have a better idea on how to get rid of this whitespace? I will keep trying and keep you posted on my findings. Thank you so much!!!
It is because of the line-height taking for all the individual elements. After changing the line-height of the body tag that space will disappear. Below is the code.
body {
line-height: 0.7;
}
As all the elements are having individual line-height you can give even lesser value (<0.7) for line-height of the body tag.
So although the originally accepted answer of using the line-height worked, it messed up all of the line-heights on the page, and after a little bit more tinkering, all that was needed was to add the margin-bottom: -5px; to the canvas element.
This solution is less invasive and achieves the same visual effect, so I will be accepting my own answer as the solution instead. Sorry Masoom!
This is the code now:
<canvas id="matrix" style="margin-left:-20px;margin-bottom:-5px;"></canvas>
I would appreciate a little assistance working with Psuedo Selectors for an ID within CSS. I cannot seem to display the first line of an ID in small caps. A snippet of both my CSS and the corresponding HTML is included for reference.
#introtext {
margin: 0px 0px 20px 0px;
background: transparent;
font-face: "arial black";
font-size: 22px;
font-weight: bold;
letter-spacing: .1em;
line-height: 1;
text-align: center;
}
#introtext:first-line {
font-variant: small-caps;
}
HTML:
<div id="introtext"><span id="introcap">H</span><span id="introtext.first">ere you will
find links to Scouting related websites and forms.</div>
Perhaps...
...your expectations are incorrect (and I know your code has an error). While I agree with the comments here that your code is working as expected, I am speculating you are attempting something different.
Did you want the first sentence in small caps?
I noticed in your code you have the "opening" tag of <span id="introtext.first"> but you failed to put the closing tag for that </span>. This is an error. However, if your intent is to have the whole first sentence to become small-caps, your code will still not work because the :first-line pseudo-element does not look at the first sentence, but the first-line (which varies based off of the container width).
Additionally
It is best to not use a . in an id, since the . is used for designating classes. And perhaps a class is what you really want anyway.
Finally, A Solution?
If my speculations about your goals are correct, then I recommend doing the following (keeping your #introtext css the same, but changing the html and :first-line code), as demonstrated in this FIDDLE.
HTML
<div id="introtext">
<span id="introcap">H</span><span class="first-sentence">ere you will find
links to Scouting related websites and forms.</span> More text to follow
in a second sentence. And a third. Blah. Blah.
</div>
CSS
.first-sentence {
font-variant: small-caps;
}
Although
It almost appears as though you intend this to be a header (since the text is centered), so maybe something like this is more semantic and also eliminates the need for your leading "H" to be separate (unless you want OLD browser support). Here is its demo FIDDLE.
HTML
<div>
<h2 id="introtext">Here you will find links to Scouting related websites
and forms.</h2> More text to follow in a second sentence. And a third.
Blah. Blah.
</div>
CSS
#introtext {
margin: 0px 0px 20px 0px;
background: transparent;
font-face: "arial black";
font-size: 22px;
font-weight: bold;
letter-spacing: .1em;
line-height: 1;
text-align: center;
font-variant: small-caps; /*<-- moved this to here*/
}
#introtext::first-letter {
font-variant: none; /*<-- reset the pseudo-element to normal */
}
I'm working with the dot HTML character to make different color icons. The problem that I'm running into is that the line-height property seems to only affect where the top of the character is placed. I can't get the dot icon to line up with regular text properly, even with a line-height set that matches the standard font-size of the text.
HTML
<div>
<b>Legend:</b>
<span class="dotib">•</span>
</div>
CSS
.dotib{font-size: 36pt; line-height: 12pt;}
Is there a better way to make this dot behave like I expect it to?
Here's a jsFiddle with this code in it: http://jsfiddle.net/TzFff/
Change to this:
.dotib {
font-size: 36pt;
line-height: 12pt;
vertical-align:middle;
padding-bottom:5px;
}
http://jsfiddle.net/TzFff/1/
I try to set the font size (13px) and line-height size (23px) for textarea control.
For example the first code: ( http://jsfiddle.net/D6T4f/ )
<TEXTAREA style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23px; height: 70px;"></TEXTAREA>
If I click inside the blank textarea the cursor will be located on correct position.
But in this code I include style background-color: ( http://jsfiddle.net/4e2dL/ )
<TEXTAREA style="background-color: white; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23px; height: 70px;"></TEXTAREA>
I added only one style background-color: white;. So, if I try to click inside the textarea the cursor will be located not like in the first code (slightly higher). But If I start typing some text, the cursor will move to correct position.
How to avoid this if I need to use this style?
The problem appears in IE 9. Chrome (latest) is OK.
The same problem caused also if I use style background-image: none;
Thanks!
Can you try to remove space or new line between HERE
It might cause because of this.
with it only being an IE9 issue, it looks to be a that when you add the background style it is also overriding and removing some other standard IE9 styles.
The solution, you are going to need to be more explicit with your styles to help normalise the styles that are affecting the textareas, I have put an example together where the styles of the textarea have been completely overwritten by the css styles to bring the two inline: http://jsfiddle.net/PXgxU/2/
Using letter-spacing seems to really screw with text-align: http://jsfiddle.net/NFAzv/
Googling hasn't turned anything up. Am I missing something here?
EDIT #1: Here's what I'm getting (Firefox 3.6.8 and Chrome 12.0.742.91 on Vista): link removed due to link limits for newbies (it can be found in the comments) (notice how the centers do not line up at all)
EDIT #2: Here's IE9, with a centered vertical line to show what's wrong: http://i.stack.imgur.com/C0J0n.png
EDIT #3: I have a confirmation in the comments below that the problem shows up for Chrome 10 on Windows 7. At least I'm not the only one going crazy.
It seems that all the browser have converged on a letter-spacing implementation that is plainly at odds with what css3 says should happen.
In particular see Example XV at http://dev.w3.org/csswg/css3-text/#letter-spacing0
Browsers simply don't do this. IE has even changed its behaviour recently (IE9, I think) to be more like the other browsers, and less like the CSS3 spec as it's currently written.
The CSS3 spec in question is still at working draft status, so presumably at some point it will be changed to match what the browsers do.
You may be able to rebalance the lines by adding a padding-left value to match the letter-spacing but that may not always be possible.
Since the problem isn't really described I assume that the text isn't centered perfectly..
You can use text-indent at half the size of the letter spacing to correct this..
.centered {
letter-spacing:12px;
text-indent:6px;
}
Only tested on Chrome OSX though..
It seems to work, but your requirement for this pixel perfectness does not comply with the default working of letter-spacing. If you highlight the text, you will see that it does center.
You could use the following workaround: demo fiddle
<div style="text-align: center;">
<div style="font-size: 130%; letter-spacing: 0.6em; padding-left: 0.6em;">THIS</div>
<div style="font-size: 350%; letter-spacing: 0.4em; padding-left: 0.4em;">ILLUSTRATES</div>
<div style="font-size: 130%; letter-spacing: 0.4em; padding-left: 0.4em;">THE</div>
<div style="font-size: 200%; letter-spacing: 0.1em; padding-left: 0.1em;">PROBLEM</div>
</div>
I have seen similar problem with links underline:last letter's width includes the letter-spacing value.
So apply letter-spacing:0; for the last letters should resolve the issue.
It's ugly but it works
...
<div style="font-size: 350%; letter-spacing: 0.4em;">
ILLUSTRATE<span style="letter-spacing:0;">S</span>
</div>
...
add 50% of the font size as text indent like this
<div style="text-align: center;">
<div style="font-size: 130%; letter-spacing: 0.6em;text-indent:0.3em">THIS</div>
<div style="font-size: 350%; letter-spacing: 0.4em;text-indent:0.2em">ILLUSTRATES</div>
<div style="font-size: 130%; letter-spacing: 0.4em;text-indent:0.2em">THE</div>
<div style="font-size: 200%; letter-spacing: 0.1em;text-indent:0.05em">PROBLEM</div>
</div>
Although this wasn't the exact question here, I had an issue that the starting left point of the text was too far to the right:
I had an issue that my text wasn't centered horisontally any longer after letter-spacing was applied but it was due to that I had restricted the texts container in width, so it was overflowing it's container.. worth to look into.. it may seem stupid but it's an easy misstake actually.
I may be late to this, but just in case my solution helps anyone.
This is an example simple button set up:
<button>Enter</button>
In my stylesheet:
button {
color: #f5ebe0;
border-color: #f5ebe0;
background-color: #00000000;
text-indent: 2rem;
width: 33%;
}
a {
color: inherit;
text-decoration: none;
letter-spacing: 2rem;
}
It seems that letter-spacing does indeed only add spacing either to the right, or only in between the letters. This being the case, (when using letter-spacing) I recommend using an anchor tag with in the button and applying your letter-spacing amount to the text inside the anchor, and then apply the SAME amount of text-indent inside your button.