School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,096 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,015 people online right now. Registration is fast and FREE... Join Now!




need more css help

 

need more css help, classes

irishgirl

30 Oct, 2009 - 10:15 AM
Post #1

D.I.C Head
**

Joined: 22 Aug, 2008
Posts: 154



Thanked: 1 times
My Contributions
I have to sections (seperated by div classes) and I need to highlight the h1 and h2 sections in different colours in both sections. In each section I have a h1 and two h2s. This is the css I have for them:

CODE

.europe h1, h2 { background-color: black; color:white; }

.africa h1, h2 { background-color: orange; color: blue; }

#image1 { float: left; }

#image2 { float: left; }



The colours seem to override each other even though they are in seperate divs? For example, right now its showing the first h1 as black but the following h2s as orange, and the africa section is all orange.

This is my html

CODE

<div class="europe">
<img src="exercise1map1.jpg" id="image1"/>
<h1>Europe</h1>
<h2>France</h2>
<p> Blah blah blah. </p>
<h2>Lithuania</h2>
<p> Blah blah blah. </p>
</div>

<div class="africa">
<img src="exercise1map2.jpg" id="image2"/>
<h1>Africa</h1>
<h2>Zimbabwe</h2>
<p> Blah blah blah. </p>
<h2>Burundi</h2>
<p> Blah blah blah. </p>
</div>

</body>


It's meant to look like the image attached.

This post has been edited by irishgirl: 30 Oct, 2009 - 10:51 AM


Attached thumbnail(s)
Attached Image
User is offlineProfile CardPM
+Quote Post


thehat

RE: Need More Css Help

30 Oct, 2009 - 10:24 AM
Post #2

awake ? web();
Group Icon

Joined: 28 Feb, 2008
Posts: 940



Thanked: 99 times
Dream Kudos: 200
My Contributions
That should be:
CODE

.europe h1, .europe h2 { background-color: black; color:white; }

.africa h1, .africa h2 { background-color: orange; color: blue; }

After a comma you basically start again with your identifier.
User is offlineProfile CardPM
+Quote Post

irishgirl

RE: Need More Css Help

30 Oct, 2009 - 10:33 AM
Post #3

D.I.C Head
**

Joined: 22 Aug, 2008
Posts: 154



Thanked: 1 times
My Contributions
Thank you anime1.gif
User is offlineProfile CardPM
+Quote Post

irishgirl

RE: Need More Css Help

30 Oct, 2009 - 10:50 AM
Post #4

D.I.C Head
**

Joined: 22 Aug, 2008
Posts: 154



Thanked: 1 times
My Contributions
Need more help..
Need css to style like image attached.
Don't know how to make boxes short and positioned? Currently what I have goes right across the page and the positioning of the image wont even appear on the screen.

My CSS is
CODE

#content {
    background-image: url('laptop.jpg');
    background-repeat: repeat-y;
    background-position: right;
}

.services { border: 1px solid #FF0000;
padding: 5px 10px 5px 5px;
background-color: blue;
font-weight: bold;
color: white;
}

.models { border: 1px solid #0000FF;
padding: 5px 10px 5px 5px;
background-color: red;
font-weight: bold;
color: white;
}



and my html is

CODE

<h1> ACME Computer Store </h1>
<div id="content"></div>
<div class="services">
<p>Our services</p>
<ul>
<li> Computer Sales </li>
<li> After-sales Service </li>
<li> Computer rentals </li>
</ul>
</div>

<div class="models">
<p>Our models </p>
<ol>
<li>Dell Latitude C-810</li>
<li>Dell Inspiron C-810</li>
</ol>


Help? smile.gif


Attached thumbnail(s)
Attached Image
User is offlineProfile CardPM
+Quote Post

W3bDev

RE: Need More Css Help

30 Oct, 2009 - 12:59 PM
Post #5

D.I.C Head
Group Icon

Joined: 15 Mar, 2009
Posts: 207



Thanked: 20 times
Dream Kudos: 50
My Contributions
First, give your services and models sections a width so they will not exceed the entire page length. Is there a reason why you are using classes instead of id's?
User is offlineProfile CardPM
+Quote Post

irishgirl

RE: Need More Css Help

30 Oct, 2009 - 01:23 PM
Post #6

D.I.C Head
**

Joined: 22 Aug, 2008
Posts: 154



Thanked: 1 times
My Contributions
Yup I've since given them a width, my output is now http://student.cs.ucc.ie/~mfos1/CS3314/exercise2.html but its still not exactly like the attached output confused.gif
User is offlineProfile CardPM
+Quote Post

irishgirl

RE: Need More Css Help

30 Oct, 2009 - 02:43 PM
Post #7

D.I.C Head
**

Joined: 22 Aug, 2008
Posts: 154



Thanked: 1 times
My Contributions
Solved.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 11:47AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month