Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to add blue underlining below subtitles

Posted on 2010-11-28
5
Medium Priority
?
351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 58

Assisted Solution

by:cyberkiwi
cyberkiwi earned 400 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 400 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 1200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

604 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