Texts wont align properly to center - html

So I got the following code.
HTML
<div id="container">
<p class="title"> Social Media </p>
<ul>
<li>Twitter</li>
<li>Deviantart</li>
<li>Skype</li>
</ul>
</div>
CSS
#container {
background-color: #FFF;
background-image: url(images/footer.jpg);
height: 250px;
margin-top: 40px;
border-top: 3px solid #C6C6C6;
border-bottom: 3px solid #C6C6C6;
}
p.title {
color: #FFF;
font-family: "Open Sans", Helvetica, sans-serif;
text-align: center;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 5px;
font-size: 24px;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
}
#container ul {
text-align: center;
word-spacing: 150px;
margin: 0;
padding: 0;
}
#container ul li {
display: inline;
font-family: "Open Sans", Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
}
#container > ul > li > a {
text-decoration: none;
color: #FFF;
letter-spacing: 5px;
text-transform: uppercase;
line-height: 3;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
}
Now, the problem is that the 3 links "TWITTER DEVIANTART SKYPE" wont align exactly as the text above saying "SOCIAL MEDIA" even though it's both aligned to center.
I don't know why though, I want the three links to be centered exactly as the SOCIAL MEDIA text above but it just isn't. Any ideas?
Here's a JSFiddle showing the issue:
http://jsfiddle.net/cuLgC/

Here's an updated fiddle with a fix: JSFiddle
The changes are noted below:
#container ul {
/* text-align: center; moved to li */
/* word-spacing: 150px; removed, this was causing issue as some words are longer */
width: 100%;
display: table; /* added */
table-layout: fixed; /* added */
margin: 0;
padding: 0;
}
#container ul li {
display: table-cell; /* added */
width: auto; /* added */
text-align: center; /* moved */
/* display: inline; removed */
font-family: "Open Sans", Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
}
The misalignment was being caused by: word-spacing: 150px; and the fact that the menu options are all different widths. If you used the same word 3 times they would align but different length words are spread according to their width.

Not the nicest way but I put <br> after two of the list elements and that drops them down.
http://jsfiddle.net/cuLgC/7/

Change
container ul li{
display: inline
}
To
container ul li{
display: block
}
http://jsfiddle.net/cuLgC/6/
Display inline puts them on one line block puts them on separate lines, hope this helps it works in the fiddle.

just add <br> tag to the list.... here is the fiddle for that..[jsfiddle][1]
[1]: http://jsfiddle.net/hh54D/7/ hope this is right...

If I understand correctly:
#container {
background-color: #FFF;
background-image: url(images/footer.jpg);
height: 250px;
margin-top: 40px;
border-top: 3px solid #C6C6C6;
border-bottom: 3px solid #C6C6C6;
}
p.title {
color: #FFF;
font-family: "Open Sans", Helvetica, sans-serif;
text-align: center;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 5px;
font-size: 24px;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
}
#container ul {
text-align: center;
word-spacing: 150px;
margin: 0;
padding: 0;
}
#container ul li {
/*display: inline;*/
float: left;
list-style: none;
width: 33.3%;
font-family: "Open Sans", Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
}
#container > ul > li > a {
text-decoration: none;
color: #FFF;
letter-spacing: 5px;
text-transform: uppercase;
line-height: 3;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
}
FIDDLE

Related

How i can Adjust icons on top left [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Hello guy's i have small problem in this design,
this is in my laptop , i want all to looks like that:
[the icons must be in top left not in the center this is in tablet
this is the problem:
also this in i need to appear in left:
i need the 2nd and 3rd pictures to look like the first one and thank you .
the code not allow me to put it here
so i can send it to you to see .
my regards friends
the icons is out of the box !
the blue line need to edit
can you pls try this. i add parent div for max width and icon position changed
css
.panel {
margin-bottom: 20px;
background-color: #F7FAFE;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: 0 1px 1px rgba(0, 0, 0, .05)
}
.panel-default {
padding: 10px;
border-color: #ddd;
}
.panel-default>.panel-heading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.mostPopular {
margin-bottom: 20px;
}
.mostPopular .headText h3 {
font-weight: 700;
margin: 0;
padding-bottom: 17px;
font-size: 17px;
width: auto;
float: left;
margin-right: 10px;
max-width: 275px;
color: #27ae60;
}
.headText {
text-align: center;
width: 100%;
display: inline-block;
}
.headText h2 {
color: #27ae60;
margin-top: 0px;
margin-bottom: 0px;
text-align: center;
font-weight: bold;
text-transform: uppercase;
}
.mostPopular #pop {
font-size: 100%;
position: relative;
top: -15px;
}
.mostPopular p {
font-family: franklin-gothic-urw-cond, 'Helvetica Condensed Bold', Helvetica, Arial, sans-serif !important;
border-bottom: 3px solid #929292;
color: #768696;
padding: 12px 0 10px;
margin-bottom: 0;
text-align: center;
text-transform: uppercase;
font-size: 12px;
}
.mostPopular li {
border-bottom: 1px solid #ddd;
-webkit-box-shadow: 0 1px 0 #fff;
-moz-box-shadow: 0 1px 0 #fff;
box-shadow: 0 1px 0 #fff;
padding: 7px 0;
position: relative;
}
.mostPopular li .index {
color: #4e5daf;
display: block;
font-size: 14px;
float: left;
line-height: 18px;
width: 25px;
font-family: franklin-gothic-urw-cond, "Helvetica Condensed Bold", Helvetica, Arial, sans-serif;
font-weight: 700;
}
.mostPopular li a {
text-align: left;
color: #505d69;
font-family: franklin-gothic-urw-cond, 'Helvetica Condensed Bold', Helvetica, Arial, sans-serif !important;
font-size: 13px;
font-weight: 700;
display: block;
line-height: 18px;
width: 100%;
}
.mostPopular li .count {
width: 40px;
color: #4e5daf;
display: block;
float: right;
font-size: 14px;
font-weight: 700;
line-height: 25px;
font-family: franklin-gothic-urw-cond, "Helvetica Condensed Bold", Helvetica, Arial, sans-serif;
}
.headLine {
border-radius: 0px 0px 20px 20px;
width: auto;
height: 0px;
overflow: hidden;
background: #eee;
-moz-box-shadow: 0 -1px 0 #83b755, 0 -2px 0 #4b8424;
background: none;
border-top: none;
border-bottom: 6px solid #3c81de;
position: relative;
top: 10px;
margin-bottom: 15px;
}
.mostPopular #pop {
font-size: 100%;
position: relative;
top: -15px;
}
.mostPopular li .index {
color: #4e5daf;
display: block;
font-size: 14px;
float: left;
line-height: 18px;
width: 25px;
font-family: franklin-gothic-urw-cond, "Helvetica Condensed Bold", Helvetica, Arial, sans-serif;
font-weight: 700;
}
.thumbnaidl {
border-bottom: 3px solid #27ae60;
background: #FFFFFF !important;
margin-top: -25.7px;
padding: 2px;
flex-direction: row;
height:23px;
}
.t11img {
width: 23px;
position: absolute;
right: 6px;
display: flex;
}

How can I remove the letter-spacing on the last letter of an <a> tag in CSS?

I'm a newbie.
I'm trying to remove the letter-spacing on the last letter for an a tag I styled into a button and centred on the page.
body {
background-color: #1E1E96;
}
a {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #FFF;
text-decoration: none;
font-size: 12px;
}
.btn-wrapper {
text-align: center;
margin: 100px auto;
}
.btn-wrapper a {
text-transform: uppercase;
text-align: center;
letter-spacing: 10px;
padding: 15px 40px;
border: solid 2px #FFF;
}
<body>
<div class="btn-wrapper">
Change Colour
</div>
</body>
I tried
.btn-wrapper a {
margin-right: -10px;
}
and
.btn-wrapper a {
text-indent: 10px;
}
with no joy.
I am loath to put a span on the last letter.
The above suggestions I found on Stack Overflow.
Can someone please explain what's going on with my code and help find a solution?
Thanks in advance.
You could wrap the entire text part of the link in a span and use the margin-right: -10px technique to get this done.
body {
background-color: #1E1E96;
}
a {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #FFF;
text-decoration: none;
font-size: 12px;
}
.btn-wrapper {
text-align: center;
margin: 100px auto;
}
.btn-wrapper a {
text-transform: uppercase;
text-align: center;
letter-spacing: 10px;
padding: 15px 40px;
border: solid 2px #FFF;
}
.btn-wrapper a span {
margin-right: -10px;
}
<body>
<div class="btn-wrapper">
<span>Change Colour</span>
</div>
</body>
Edit :
Browsers have bugs.
Firefox bug is https://bugzil.la/299943 and the one for Chrome is https://crbug.com/267056.
You could simply incorporate the displacement inside padding with:
padding: 15px 30px 15px 40px; // no <span>s required
Maybe try change padding, so instead of 40px right use 30px, which is 40px - 10px letter-spacing.
.btn-wrapper a {
text-transform: uppercase;
text-align: center;
letter-spacing: 10px;
padding: 15px 30px 15px 40px;
border: solid 2px #FFF;
}
<body>
<div class="btn-wrapper">
Change
</div>
<style>
body {
background-color: #1E1E96;
}
a {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #FFF;
text-decoration: none;
font-size: 12px;
}
.btn-wrapper {
text-align: center;
margin: 100px auto;
}
.btn-wrapper a {
text-transform: uppercase;
text-align: center;
letter-spacing: 10px;
padding: 15px 40px;
padding-right: 30px;
border: solid 2px #FFF;
}
</style>
</body>
Edited the padding and thats it :D decreased right padding of <a></a> to 30
Use like this
body {
background-color: #1E1E96;
}
a {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #FFF;
text-decoration: none;
font-size: 12px;
}
.btn-wrapper {
text-align: center;
margin: 100px auto;
}
.btn-wrapper a {
text-transform: uppercase;
text-align: center;
letter-spacing: 10px;
padding: 15px 40px;
border: solid 2px #FFF;
}
.btn-wrapper a span {
margin-right: -10px;
letter-spacing:10px;
}
</style>
<body>
<div class="btn-wrapper">
<span>Change Colour</span>
</div>
</body>

Creating an HTML link is creating unexpected results

I need help figuring out why it is when I add a link in this code that it is altering my entire div block.
This is what the page looks like:
As soon as I make the text a link, it adds about 8px to the bottom (notice how the image is smaller than the div block).
What can I do to make this look like all of my other blocks?
Update: I believe I found the code that is causing the problem, it is in the CSS of the body. There is a style that has line-height at line-height: 1.625; - when I delete this, it fixes the issue. But now I am wondering how can I remove this code for my page, without effecting the rest of the site?
Here is the problem CSS:
body {
color: #3B3F42;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1em;
line-height: 1.625;
}
And here is the rest of the coding
.ratingWrapTopRated {
background: #fff;
width: 100% !important;
height: 90px !important;
margin: 0 auto;
display: table;
font-family: Helvetica, Arial, sans-serif;
margin-bottom: 10px;
}
.cigarImage {
background: #fff;
color: #fff;
display: table-cell;
line-height: 0;
width: 90px;
padding-right: 4px;
}
.cigarName {
background: #ff5100;
color: #fff;
text-align: center;
display: table-cell;
vertical-align: middle;
word-spacing: 6px;
text-transform: uppercase;
font-size: 1.2em;
padding: 0px 3px 0px 3px;
}
.numericalScoreTopCigars {
background: #000;
color: #fff;
text-align: center;
width: 25%;
display: table-cell;
font-size: 4.9em;
letter-spacing: 3px;
vertical-align: middle;
font-weight: bold;
border-left: 4px solid;
border-color: #fff;
line-height: 0;
}
a.ratingsLink:link {
text-decoration: none;
background: #ff5100;
color: #fff;
text-align: center;
vertical-align: middle;
word-spacing: 6px;
text-transform: uppercase;
font-size: 1em;
padding: 0px 3px 0px 3px;
}
<span class="ratingWrapTopRated">
<span class="cigarImage hidebuttons"><img class="alignnone size-thumbnail wp-image-2352" src="http://cigardojo.com/wp-content/uploads/2012/08/padron-serie-1926-150x150.jpg" alt="Padron Serie 1926 No. 9 Maduro" width="150" height="150" /></span>
<span class="cigarName shortenText"><a class="ratingsLink" href="http://cigardojo.com/?p=1019">Fuente Fuente OpusX XXX Belicoso</a></span>
<span class="numericalScoreTopCigars">96</span>
</span>

Drop Down Being Pushed To the Right?

For some reason, my drop down menu is being pushed to the right. It's supposed to open up directly below the link someone is hovering over, but it opens about 30px to the right and I can't figure out why. You can see the issue in action when you scroll over "Work" on my website: http://www.noellesnotes.com
My code:
CSS
ul.site-navigation {
text-align: center;
list-style: none;
}
ul.site-navigation li a{
padding: 50px 0 47px 0;
font-family: 'Arvo', serif, Georgia;
width: 125px;
float: left;
letter-spacing: 4px;
text-transform: uppercase;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;
color: rgb(82,82,82);
border-bottom: 3px solid transparent;
}
ul.site-navigation > li {
position: relative;
width: 125px;
float:left;
margin: 0;
}
ul.site-navigation a:hover{
font-weight: bold;
border-bottom: 3px solid rgb(4,141,195);
text-shadow: rgb(200, 200, 200) 1px 1px 0px;
padding: 97px 0 0 0;
}
ul.site-navigation ul {
list-style: none;
height: 50px;
left: 0;
z-index: 1000;
padding: 0;
display: none;
}
ul.site-navigation ul li {
float: none;
}
ul.site-navigation li:hover ul {
display: block;
position: absolute;
top: 100%;
left: 0;
}
ul.site-navigation ul li a {
font-weight: regular;
font-size: 16px;
text-shadow: none;
padding: 5px 10px;
width: auto;
height: auto;
text-transform: uppercase;
border: 2px solid #FFF;
color: #FFF;
margin: 5px 10px 0 0;
}
ul.site-navigation ul li a:hover {
font-weight: regular;
font-size: 16px;
text-shadow: none;
padding: 5px 10px;
width: auto;
height: auto;
text-transform: uppercase;
border: 2px solid #FFF;
color: #FFF;
}
.site-title a {
color: rgb(185,40,141);
font-family: 'Arvo', serif;
text-transform: uppercase;
font-size: 63px;
background-color: rgba(255,255,255,1);
text-align: center;
text-shadow: #FFF 1px 1px,#ccc 2px 2px;
width: 500px;
float: left;
padding-top: 13px;
font-weight: normal;
letter-spacing: normal;
}
.site-branding {
display: table;
width: 100%;
height: 400px;
font-family: 'Lato', verdana, san-serif;
font-size: 6em;
text-shadow:1px -1px rgba(242,141,89,0.2);
text-align: center;
text-transform: uppercase;
color: rgb(255,255,255);
background-image: url('http://www.noellesnotes.com/wp-content/themes/portfolio/images/lights.jpg');
background-attachment:fixed;
}
HTML:
<ul class="site-navigation">
<li>About</li>
<li>Work
<ul class="submenu">
<li>Seventeen.com</li>
<li>One Direction Connection</li>
</ul>
</li>
</ul>
You have a left margin on all uls that are direct children of lis. (li > ul {margin-left:1.5em})
Add Something like this to your css to override that for your menu:
ul.site-navigation > li > ul {
margin-left:-2.75em
}
I think its natural because li tag has ul tag
You can use margin-left:-2px to fix this

How do I stop text from showing / flowing outside of an <h3> tag?

I'm not sure why, but I get this text showing / flowing outside of the <h3> tag. I thought it was something to do with floats, but I have tried all the solutions I know to fix it and they haven't worked.
Here is jsfiddle (I'm in Safari): http://jsfiddle.net/BJCkv/1/
HTML :
<div id="header-container">
<div class="wrapper"> <!-- has width of 940px; and aligned in middle -->
<h1>PCSA - TRAINING</h1>
<h3>Security Architecture</h3> <!-- This is the problem text -->
</div>
</div>
CSS :
#header-container {
height: 84px;
line-height: 84px;
background-color: #e0dfd9;
background-image: url(../img/header.png);
border-top: 1px solid #ccccc7;
border-bottom: 1px solid #ccccc7;
}
#header-container .wrapper {
overflow: hidden;
}
#header-container h1 {
color: #b8622b;
font-family: 'Open Sans', sans-serif;
font-size: 38px;
text-shadow: 0 1px 0 #f7f7f5;
font-weight: 600;
float: left;
background: red;
}
#header-container h3 {
color: #a5a5a4;
float: left;
font-family: 'Open Sans', sans-serif;
font-style: italic;
padding: 3px 0 3px 10px;
margin-left: 20px;
height: 30px;
border-left: 1px solid #a5a5a4;
background: yellow;
}
You can replace height: 30px; with line-height: 30px; That should solve the problem.
http://jsfiddle.net/BJCkv/7/
You need to reset the line-height for the h3 element: Live demo: http://jsfiddle.net/BJCkv/5/
#header-container h3 {
line-height: 30px; /* add this */
color: #a5a5a4;
float: left;
font-family: 'Open Sans', sans-serif;
font-style: italic;
padding: 3px 0 3px 10px;
margin-left: 20px;
height: 30px;
border-left: 1px solid #a5a5a4;
background: yellow;
}