Compatible browser

Hello
this code is not compatible with google chrome

element.style {
position: absolute;
display: block;
height: 290px;
width: 214px;
top: 9px;
left: 539px;
}

what’s the problem?

There is no problem and the code will work fine in all browsers.


<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.test {
    position: absolute;
    /*display: block; not needed but will do no harm*/
    height: 290px;
    width: 214px;
    top: 9px;
    left: 539px;
    background:red;/* for testing only*/
}
</style>
</head>
<body>
<div class="test">I work OK</div>
</body>
</html>


It is likely that you were expecting something else to happen or you have other rules conflicting with the above.:slight_smile:

You’ll have to provide more information and code and explain what you expected to happen or what is happening in chrome that you think is wrong.

Paul’s being polite… I lack an internal censor…

  1. CSS without the markup it’s applied to and the layout it’s inside is gibberish. This falls into the “and this is why we can’t help you” category.

  2. Position:absolute elements are INHERENTLY display:block, so there’s no need to say that again in your code.

  3. Define “doesn’t work”?