Solved

how to add blue underlining below subtitles

Posted on 2010-11-28
5
342 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
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 tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

690 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