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
Solved

Very basic CSS written in Dreamweaver is not working

Posted on 2007-11-21
6
204 Views
Last Modified: 2012-08-13
I am trying to create my first CSS style sheet from scratch (I've worked a little bit with pre-existing ones) and I can't figure out why it's not working.

Also, I can't figure out why the styles I create have the dot before them while the styles in the pre-existing template don't have dots. (Assuming this is of any relevance)
Also, how do I create a specific div? These seem to be the ones with # in front of them.

But for starters, why isn't the text in the Intro div picking up Intro's properties?

Thanks,
John
CSS CODE:
html {
	margin: 0;
	padding: 0;
	}
body { 
	font: 16px/1.88889 "Gill Sans MT";
	color: #000000; 
	background: #fff url(h1.jpg) no-repeat bottom left; 
	margin: 0; 
	padding: 0;
	}
.Intro {
	font-family: "Brush Script MT";
	font-size: 24px;
	font-weight: bold;
	color: #FF3399;
}
 
HTML CODE:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
	<script type="text/javascript"></script>
	
	<style type="text/css" media="all">
	</style>
	
    <link href="textra.css" rel="stylesheet" type="text/css" />
</head>
<body>
		<div id="Intro">
			<p class="p1">Why isn't this text showing up as 24px, Brush Script, #CC66FF, bold? <br />
</div>
 
And this one?
</body>
 
</html>

Open in new window

0
Comment
Question by:gabrielPennyback
  • 4
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 500 total points
ID: 20332085
> Also, I can't figure out why the styles I create have the dot before them while the styles in the pre-existing template don't have dots.

pre-existing template contains the HTML TAG names, which can not be changed, body is a valid HTML tag so CSS parser knows i am applying this to the BODY of HTML. but if you create a custom Class you put . next to it and for the IDs you use #.

 > why isn't the text in the Intro div picking up Intro's properties

in CSS nesting rule works. in your example you have..
<div id="Intro">
<p class="p1">Why isn't this text showing up as 24px, Brush Script, #CC66FF, bold? <br />
</div>

so in your CASE "p1" will be applied to the Text because it comes AFTER div id="Intro".

also in your CASE it should say #Intro in the declaration because it is a "ID".




0
 
LVL 23

Assisted Solution

by:Saqib Khan
Saqib Khan earned 500 total points
ID: 20332089
Correct Version Should be...
CSS CODE:
html {
	margin: 0;
	padding: 0;
	}
body { 
	font: 16px/1.88889 "Gill Sans MT";
	color: #000000; 
	background: #fff url(h1.jpg) no-repeat bottom left; 
	margin: 0; 
	padding: 0;
	}
#Intro {
	font-family: "Brush Script MT";
	font-size: 24px;
	font-weight: bold;
	color: #FF3399;
}
 
HTML CODE:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
	<script type="text/javascript"></script>
	
	<style type="text/css" media="all">
	</style>
	
    
</head>
<body>
		<div id="Intro">
			Why isn't this text showing up as 24px, Brush Script, #CC66FF, bold? <br />
</div>
 
And this one?
</body>
 
</html>

Open in new window

0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 20332093
Below is the Version for Copy and Paste (Quick Test)
<style>
 
html {
	margin: 0;
	padding: 0;
	}
body { 
	font: 16px/1.88889 "Gill Sans MT";
	color: #000000; 
	background: #fff url(h1.jpg) no-repeat bottom left; 
	margin: 0; 
	padding: 0;
	}
#Intro {
	font-family: "Brush Script MT";
	font-size: 24px;
	font-weight: bold;
	color: #FF3399;
}
</style>
 
HTML CODE:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
	<script type="text/javascript"></script>
	
	<style type="text/css" media="all">
	</style>
	
    
</head>
<body>
		<div id="Intro">
			Why isn't this text showing up as 24px, Brush 
 
Script, #CC66FF, bold? <br />
</div>
 
And this one?
</body>
 
</html>

Open in new window

0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 1

Author Comment

by:gabrielPennyback
ID: 20332203
Thanks! you know I tried just renaming .Intro with a #, and it wouldn't take.  How did you do it?
Anyway, I didn't have to change the html at all for it to work.  also, even though referring to an external CSS file is hardly relevant for this page, I'm trying to lean the basics so I will be able to start learning how to do more sophisticated pages with CSS. So how would the HTML code go with the reference to the external stylesheet restored?

Also  if I wanted to limit the size of the Intro ID box, how would I do it.  I tried doing it with the box parameters in the style sheet, but it didn't do any good. How do I do that?

Finally where can I download something that will reallydefine and explain all of the terms for me: div, id, class, etc.

Thanks,
John
0
 
LVL 23

Assisted Solution

by:Saqib Khan
Saqib Khan earned 500 total points
ID: 20332221
ok external link to CSS is same as you have CSS code written within the same file. so that should not be a problem.

Secondly why my code worked for text is because you have a <p> tag with a class name which overwrites the INTRO id, as i said before CSS is all about nesting, HTML will apply the closet Class/ID property to it.

its time to do alot of reading on CSS

and if want to limit the wize you use width and height property.

http://www.cssbasics.com/
www.w3schools.com
0
 
LVL 1

Author Comment

by:gabrielPennyback
ID: 20332300
thanks, adilkhan.  The links look great. Could be just what I need right now.

John
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Overlap photo won't go all the way to the right 1 23
Box Locations 6 20
Best way to minify CSS with out breaking it 7 41
Css regex 6 38
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

790 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