Solved

how to add blue underlining below subtitles

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

Technology Partners: 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

Suggested Solutions

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

738 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