Solved

how to add blue underlining below subtitles

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

929 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

15 Experts available now in Live!

Get 1:1 Help Now