Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


CSS Styling - Div Box and H1 Links

Posted on 2012-04-10
Medium Priority
Last Modified: 2012-04-19
I have h1 tags inside a div box (want the whole div box clickable) below and the h1 tag links have underlines and I am trying to get rid of them.  I am missing something here....

<a href="#">
     <div id="home-annoucement">
    	<h1 class="annoucement1">Open House </h1>
                 <h1 class="annoucement1">Today!</h1>
                 <h1 class="annoucement1">Click here for more information...</h1>
    </div><!-- home-annoucement -->

Open in new window


#home-annoucement {
	background-color: #FFC;
	padding: 4px;
	height: 70px;
	width: 880px;
	border: 1px solid #FC3;
	margin-left: 13px;

#home-annoucement h1 {
	font-size: 18px !important;
	color: #000 !important;
	margin: 0px !important;
	padding: 3px !important;
	text-align: center !important;
	text-decoration: none !important;

Open in new window

Question by:keith1001
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
  • 2
LVL 84

Expert Comment

by:Dave Baldwin
ID: 37829799
For class="annoucement1", 'annoucement1' is not the same as #home-annoucement h1 that you show above.  You need to find plain 'annoucement1' in your CSS.
LVL 16

Expert Comment

ID: 37829809
Do it like this instead:

    <div id="home-annoucement" onclick="location.href='';" style="cursor:pointer;">
        <h1 class="annoucement1">Open House </h1>
        <h1 class="annoucement1">Today!</h1>
        <h1 class="annoucement1">Click here for more information...</h1>
    <!-- home-annoucement -->

Open in new window

LVL 16

Expert Comment

ID: 37829825
Wrapping a div in an anchor tag like that isn't standards compliant and could cause you some headaches in the future.

The inline js in my example isn't very elegant and there are other methods, but it'll get the job done.
LVL 16

Accepted Solution

HagayMandel earned 2000 total points
ID: 37831051
The CSS:
<style type="text/css">
.annoucement1 {
	text-decoration: none;
	padding: 12px;
	background-color: #FFFFCC;
 #wrapper a {
	text-decoration: none;

Open in new window

<div id="wrapper"><a href="#">     
    <h1 class="annoucement1">Open House <br /> 
    Today!<br />Click here for more information...</h1>

Open in new window


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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.
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 style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

722 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