/    Sign up×
Community /Pin to ProfileBookmark

The current project I’m working on:

[url]www.themusicstudioofnewjersey.com[/url]

On a regular monitor, it all appears centered, but on laptops and widescreens, the text is not centered. I know it’s because I used layers in dreamweaver to add the text and nudged the layer to center it, but how where would I place the <center> tag in the coding to center each layer?

[code]<html>
<head>
<title>The Music Studio Of New Jersey</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<style type=”text/css”>
<!–
#Layer1 {
position:center;
left:479px;
top:429px;
width:394px;
height:366px;
z-index:1;
}
#Layer2 {
position:absolute;
left:399px;
top:433px;
width:365px;
height:570px;
z-index:1;
}
#Layer3 {
position:absolute;
left:402px;
top:431px;
width:367px;
height:434px;
z-index:1;
}
#Layer4 {
position:absolute;
left:480px;
top:374px;
width:252px;
height:33px;
z-index:1;
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-style: italic;
font-size: 12px;
}
#Layer5 {
position:center;
left:477px;
top:416px;
width:382px;
height:402px;
z-index:2;
}
.style2 {
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}
–>
</style>
</head>
<body bgcolor=”#FFFFFF” leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″>
<center><div class=”style1″ id=”Layer4″>&quot;Educating Lives Through Music.&quot; </div></center>
<div id=”Layer5″>
<p class=”style2″>Welcome to the <strong>Music Studio of New Jersey</strong>. We are focused on providing the best instruction within our creative and professional environment. Beginner through advanced; we provide instruction for guitar, piano, bass, vocals, and drums.</p>
<p class=”style2″>&nbsp;</p>
<p class=”style2″>Call now for enrollment in our <strong>Winter 2007 group vocal and drum programs</strong>. Students will enjoy learning in our relaxed environment by having the benefits of small group interaction and discussion. Learning the art of music has never been more exciting and fun! </p>
<p class=”style2″>&nbsp;</p>
<p class=”style2″>We offer professional digital recording on the premisis in our state-of-the-art facility. Recording sessions can be priced to meet your budget! Artists of all genres can record, mix, and master their music with our producers and engineers. </p>
<p><span class=”style2″>We offer private and group instruction rates which can be obtained by <a href=”contact.html”>contacting</a> the school<strong> for tuition information</strong></span><strong>.</strong> </p>
</div>
<center><table id=”Table_01″ width=”851″ height=”901″ border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td rowspan=”23″>
<img src=”images/index_01.gif” width=”61″ height=”900″ alt=””></td>
<td>
<a href=”about.html”><img src=”images/index_02.gif” alt=”” width=”155″ height=”53″ border=”0″></a></td>
<td colspan=”7″>
<a href=”vocal.html”><img src=”images/index_03.gif” alt=”” width=”126″ height=”53″ border=”0″></a></td>
<td colspan=”4″>
<a href=”bass.html”><img src=”images/index_04.gif” alt=”” width=”92″ height=”53″ border=”0″></a></td>
<td colspan=”3″>
<a href=”drums.html”><img src=”images/index_05.gif” alt=”” width=”87″ height=”53″ border=”0″></a></td>
<td colspan=”5″>
<a href=”guitar.html”><img src=”images/index_06.gif” alt=”” width=”76″ height=”53″ border=”0″></a></td>
<td colspan=”2″>
<a href=”recording.html”><img src=”images/index_07.gif” alt=”” width=”83″ height=”53″ border=”0″></a></td>
<td colspan=”2″>
<a href=”contact.html”><img src=”images/index_08.gif” alt=”” width=”110″ height=”53″ border=”0″></a></td>
<td rowspan=”23″>

[B]<<< VARIOUS IMAGE CODES DELETED FOR SHORTER POST LENGTH>>>> [/B]

</table>
<!– End ImageReady Slices –>
</body>
</html>[/CODE]

to post a comment
HTML

6 Comments(s)

Copy linkTweet thisAlerts:
@_Aerospace_Eng_Dec 15.2006 — Yikes. Well using DW for "layers" was your first mistake. Absolute positioning for most layouts is almost always never needed. Its not going to be as simple as just adding a center tag. It seems that you dove into coding but really had no idea what you were doing. Now you let a program do the work for you and now you are stuck because you don't know what the code is actually doing. Solution: Learn to code by hand.

You have a basic 2 column layout that can be done without positioning or tables but you are going to have to slice your layout differently thinking in terms of columns.
Copy linkTweet thisAlerts:
@Woah_its_MattauthorDec 15.2006 — Yikes. Well using DW for "layers" was your first mistake. Absolute positioning for most layouts is almost always never needed. Its not going to be as simple as just adding a center tag. It seems that you dove into coding but really had no idea what you were doing. Now you let a program do the work for you and now you are stuck because you don't know what the code is actually doing. Solution: Learn to code by hand.

You have a basic 2 column layout that can be done without positioning or tables but you are going to have to slice your layout differently thinking in terms of columns.[/QUOTE]




I never touched the code, I just imported the HTML from Photoshop and added a center tag on the table to center the template. I added the layers because the client was unsure of what he wanted there, so instead of just adding the text in photoshop, I added it on DW.

Would it be wise to take the template back to PS and add the text in there, then just change the slice overflow to auto? ?
Copy linkTweet thisAlerts:
@_Aerospace_Eng_Dec 15.2006 — I think you should view this tutorial. Again no need for absolute positioning.

http://www.rafidhasit.com/tutorials/slicing/tutorial.html

So you are doing a website for someone but have no idea how to write html?
Copy linkTweet thisAlerts:
@Woah_its_MattauthorDec 15.2006 — I think you should view this tutorial. Again no need for absolute positioning.

http://www.rafidhasit.com/tutorials/slicing/tutorial.html

So you are doing a website for someone but have no idea how to write html?[/QUOTE]


I can read it, but writing it is not my strong point. Everyone has to start somewhere.

Thank you for the tut. I know you hate new coders but, where else am I to get help.
Copy linkTweet thisAlerts:
@SimplifierMar 22.2007 — I handled the same problem by putting the whole thing in a single-cell table.

Try the page below and you'll see that the content, INCLUDING the nested layer, holds its position relative to the center of the page regardless of screen resolution. The key is to make the table and the containing div the same width. A curious thing about this is that the containing layer can still have behaviors apllied to it even though its position is relative which means that it is, technically, not a layer. (Doesn't show up in the "Layers" panel.)

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Untitled Document</title>

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_reloadPage(init) { //reloads the window if Nav4 resized

if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_showHideLayers() { //v6.0

var i,p,v,obj,args=MM_showHideLayers.arguments;

for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];

if (obj.style) { obj=obj.style; v=(v=='show')?'visible'?v=='hide')?'hidden':v; }

obj.visibility=v; }

}

//-->

</script>

</head>



<body>



<table width="600px" align="center">

<tr>

<td>



<div id="containingdiv" style="position:relative; left: 0px; top: 0px;">



<div id="Layer1" style="position:absolute; width:600px; height:400px; z-index:1; background-color: #0099FF; layer-background-color: #0099FF; border: 1px none #000000;">
<p>Main Content Layer</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="#" onMouseOver="MM_showHideLayers('Layer1','','inherit','Layer2','','show')" onMouseOut="MM_showHideLayers('Layer2','','hide')">Mousover behavior</a> </p>
</div>

<div id="Layer2" style="position:absolute; width:200px; height:115px; z-index:2; left: 505px; top: 329px; background-color: #FFCC99; layer-background-color: #FFCC99; border: 1px none #000000; visibility: hidden;">Show/Hide Layer</div>


</div>

</td>

</tr>

</table>

</body>

</html>
Copy linkTweet thisAlerts:
@SimplifierMar 22.2007 — Oops. Key is to have table same size as Layer1 (layer containing nested layers.) containingdiv has no size attribute.
×

Success!

Help @Woah_its_Matt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...