Solved

CSS Styling - Div Box and H1 Links

Posted on 2012-04-10
4
277 Views
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 -->
</a>

Open in new window



------------------------CSS-----------------

#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

0
Comment
Question by:keith1001
  • 2
4 Comments
 
LVL 83

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.
0
 
LVL 16

Expert Comment

by:s8web
ID: 37829809
Do it like this instead:

    <div id="home-annoucement" onclick="location.href='http://www.wolframalpha.com/';" style="cursor:pointer;">
        <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

0
 
LVL 16

Expert Comment

by:s8web
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.
0
 
LVL 16

Accepted Solution

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

Open in new window


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

Open in new window

0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

772 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