Why div align failed with Safari 5.05 for Windows

13 views
Skip to first unread message

justaguy

unread,
May 31, 2012, 12:36:31 PM5/31/12
to Design the Web with CSS
Hi,

The following DIV with id of log failed to right aligned the div, how
come?
Thanks in advance.

<html>
<head>
<title>Quick Notes Access by Subject</title>
<style>
.menu {
float: right;
text-align: right;
background-color: #EFF9FC;
}
</style>
</head>

<body>

<table>
<tr>
<td colspan="2" nowrap="true" style="font: bold 120% verdana;
color:#3366CC;">Quick Notes by Subject</td>
</tr>



</table>


<div id="log" style="align:right" >
...
</div>

<table>
....
</table>

</body>
</html>

buyz lots

unread,
May 31, 2012, 12:57:08 PM5/31/12
to css-d...@googlegroups.com
Looks like your are applying those attributes to a class that does not exist (.menu)  Use #log instead of .menu (I assume that is the div you are trying to float.)  Also, remove the inline style from div#log for two reason, #1 inline styles are a bit gross, #2 align is not a css property.
On May 31, 2012, at 12:36 PM, justaguy wrote:

.menu

justaguy

unread,
May 31, 2012, 1:17:02 PM5/31/12
to Design the Web with CSS
buyz,

The following div of nav is not right-aligned. Also, my previous code
works as expected for Firefox 12 (that is, the div is right-aligned
but not for Safari). And also, for the scripting language I'm using
for the app, # is a special character, it is escaped via prefixing
another one to it, I tried both ##menu and #menu to no avail (for div
alignment), hmm, not sure what's going on. Thanks.

DOM loaded
=======
<html>
<head>
<title>Quick Notes Access by Subject</title>
<style>
#menu {
float: right;
text-align: right;
background-color: #EFF9FC;
}
</style>
</head>

<body>


<div id="nav" class="menu">
<a href="fancyNote.cfm">Add Note</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="logout.cfm">Logout</a>
<br/>
</div>
</body>
</html>

MiB

unread,
May 31, 2012, 5:14:00 PM5/31/12
to css-d...@googlegroups.com

31 maj 2012 19.17 justaguy wrote:

> #menu {
> float: right;
> text-align: right;
> background-color: #EFF9FC;
> }

the "#" designates an id, not a class. It's the "."-prefix that
designates a class in the html code and this selects it for the style
rules within the brackets.
So as selector you'd use ".menu" or "#nav" in this case.

#nav {
float: right;
text-align: right;
background-color: #EFF9FC;
}

I would recommend you get a book on CSS design. For me it was Andy
Clarke's "Transcending CSS" from 2006 that turned my life around. His
later "Hardboiled Web Design" is also good, but as good very
designeroriented intro I recommend the first title. This books teach a
very useful mindset and a lot of hard won knowledge.


/MiB




justaguy

unread,
Jun 11, 2012, 9:03:30 AM6/11/12
to Design the Web with CSS
thanks, fixed.
Reply all
Reply to author
Forward
0 new messages