[RESOLVED] Styles within a div
Hi,
I know I can move a element in a div for example a paragraph by putting:
Code:
div.main p {
margin-left: 215px;
}
In a css file an referencing the css within the html file! However, how would I do this say with a selection of elements like headers?
I tried:
Code:
div.main h {
margin-left: 215px;
}
But that didn't work because of the number of the particular header say "3" wasn't being referred to.
TIA
Nightwalker
Re: [RESOLVED] Styles within a div
Hi there Nightwalker83,
this code...
Code:
div.main#object{
margin-left: 215px;
}
...requires a space between 'main' and the '#' or the '#' being removed altogether.
However, this code...
Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="320" height="75" tabindex="14" title="Alpha">
<param name="movie" value="alpha.swf" />
<param name="quality" value="high" />
</object>
...has not been given an id or class at all.
If this object element is unique within the div element class="main" use...
Code:
div.main object{
margin-left: 215px;
}
..and if there are more than one then give them a class - (say class="myflash" ) - and use...
Code:
div.main .myflash {
margin-left: 215px;
}
Re: [RESOLVED] Styles within a div
Thanks, do you know the fire fox equivalent of that code? The code you just posted doesn't in FF.
Re: [RESOLVED] Styles within a div
Hi there Nightwalker83,
the code will work in Firefox, as this example will show..
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
body {
margin:0;
}
div.main .myflash {
margin-left:215px;
}
</style>
</head>
<body>
<h3><--- 215px ---></h3>
<div class="main">
<object class="myflash" type="application/x-shockwave-flash" data="http://www.coothead.co.uk/images/smiles.swf" width="400" height="300">
<param name="movie" value="http://www.coothead.co.uk/images/smiles.swf">
</object>
</div>
</body>
</html>
Re: [RESOLVED] Styles within a div
@ Coothead,
I have tested that code in 5 different browsers on 2 different computers and it works!
However, I can't understand why it's not working correctly? The object is suppose to move positions according to specifications in the css file. Unfortunately it does not and I can't figure out why.
html:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="test.css" rel="stylesheet" title="" type="text/css" />
</head>
<body>
<h3><--- 215px ---></h3>
<div class="main">
<object class="myflash" type="application/x-shockwave-flash" data="http://www.coothead.co.uk/images/smiles.swf" width="400" height="300">
<param name="movie" value="http://www.coothead.co.uk/images/smiles.swf" />
</object>
</div>
</body>
</html>
css:
Code:
@charset "utf-8";
/* CSS Document */
body {
margin:0;
}
div.main .myflash {
margin-left: 900px;
}
This is confusing me!
Edit II:
The way I've found is by using a lot of to push the object in to place like so:
Code:
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','320','height','75','tabindex','14','title','Alpha','movie','alpha','quality','high'); //end AC code
</script>
Re: [RESOLVED] Styles within a div
I have just used the code in post #5 then wrapped it in a div class = "flash".
That is the only other method (I know) of moving the object besides the above post's method.
Re: [RESOLVED] Styles within a div
Hi there Nightwalker83,
Quote:
This is confusing me!
Well, the cause of your confusion is here...
Code:
div.main.myflash {
margin-left: 900px;
}
This part of the code will work OK...
div.main
...with no space between div and .main, but with this...
div.main.myflash
...you must leave space between .main and .myflash....
Code:
div.main .myflash {
margin-left: 900px;
}
I did point out this error to you in a previous post but you must have overlooked it. ;)
1 Attachment(s)
Re: [RESOLVED] Styles within a div
Quote:
Originally Posted by coothead
I did point out this error to you in a previous post but you must have overlooked it. ;)
I didn't over look it! I tried it and it didn't work. :p
The code I posted above is suppose have the space between ".main" and ".myflash".
Edit:
I have attached an example using your code! This one works. However, when using the same exact code in mine it doesn't work.
I suspect the problem has something to do with the AC_FL_RunContent.js which, my code uses but yours does not.
Code:
<script type="text/javascript">
<!--AC_FL_RunContent-->
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','320','height','75','tabindex','14','title','Alpha','movie','alpha','quality','high'); //end AC code
</script>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="320" height="75" tabindex="14" title="Alpha">
<param name="movie" value="alpha.swf" />
<param name="quality" value="high" />
</object>
Edit II:
I found out something about the current code I am using the <noscript></noscript> tags can only be place around an <object></object> and not the <script><script>. However, the opposite is true with the div class.
Re: [RESOLVED] Styles within a div
Is there a way I can use the "class" code within a script tag? If not is there another way to achieve the same effect without have to use tons of to move the object in to place?
Edit:
I just wrapped the script in div tags like I did before.
Code:
<div class="flash">
<script>
code
</script>
</div>
Still haven't figured out I better way of doing the above when the script tags are involved. :mad: