Solved

how to add blue underlining below subtitles

Posted on 2010-11-28
5
336 Views
Last Modified: 2012-06-22
Hi!

Currently, we have a black line under the subtitles of our pages.
How can we replace the black line with a blue line like this site uses?
http://www.ehow.com
For example, Today's Top ...

Here is an example of our code:

HTML:
<p class="main4">... What’s Important</p>

CSS:
p.main4 {
    font: bold 16px "Tahoma", Arial, sans-serif;
    color: #000000;
    text-align: left;
    text-decoration: underline;

Any specific suggestions would be appreciated.
0
Comment
Question by:TrueBlue
5 Comments
 
LVL 58

Assisted Solution

by:cyberkiwi
cyberkiwi earned 100 total points
ID: 34227492
You may need some work to make it fit your page.
It uses a border and liberal padding/margins instead

p.main4 {
    font: bold 16px "Tahoma", Arial, sans-serif;
    text-align: left;
    border-bottom:7px solid #0000ff;
    padding:0 0 5px;
}
0
 
LVL 8

Expert Comment

by:Zado
ID: 34228953
@cyberkiwi's code is right, but there's one small detail, when you use this code you'll get this:
 without <span>but you want to have underlined your title only, so you need to use <span> tag:

p.main4 span {
    font: bold 16px "Tahoma", Arial, sans-serif;
    text-align: left;
    border-bottom:7px solid #0000ff;
    padding:0 0 5px;
    text-decoration:none;
}

Open in new window


And use this in your html code:

<p class="main4">
  <span>Your title here</span>
</p>

Open in new window


With this code you will get proper format like this:
 with <span>
0
 
LVL 2

Assisted Solution

by:wasim117
wasim117 earned 100 total points
ID: 34229062
you can make p inline element : and achieve the same effect.

p.main4 {
    font: bold 16px "Tahoma", Arial, sans-serif;
    color: #000000;
    text-align: left;
    text-decoration: underline;
border-bottom:7px solid #0000ff;
display:inline;
}

Open in new window

0
 

Author Comment

by:TrueBlue
ID: 34231279
Zado,

It works fine for left justified, but when I change the code to text-align: center;
both the text and line stay left justified.
Here is an example:
http://www.topsecurityinc.com/security-systems.asp
The title from "From Basic Security..." is left justified although the css is set to center.

p.main8 span {
    font: bold 16px "Tahoma", Arial, sans-serif;
    text-align: center;
    border-bottom:7px solid #3D9BF9;
    padding:0 0 5px;
    text-decoration: none;
}

 <p class="main8"><span>From Basic Security ...</span></p>

Any ideas?
0
 
LVL 8

Accepted Solution

by:
Zado earned 300 total points
ID: 34231622
Sure, you need to apply 'text-align:center' to <p> tag in your css, not to <span>:

p.main8 { 
    text-align:center
}
p.main8 span {
    font: bold 16px "Tahoma", Arial, sans-serif;
    border-bottom:7px solid #3D9BF9;
    padding:0 0 5px;
    text-decoration: none;
}

Open in new window


You can simply do it this way:

p.main2,
p.main5,
p.main7,
p.main8 { 
    text-align:center
}

Open in new window


Instead

p.main2 { 
    text-align:center
}
p.main5 { 
    text-align:center
}
p.main7 { 
    text-align:center
}
etc...

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now