Jump to content

[SOLVED] Why oh why css?


ngreenwood6

Recommended Posts

I have a css file:

 

body {
margin:0 auto;
width:800px;
height:100%;
border:1px solid #000000;
}
#input {

}
#get {

}

#time {
float:right;
}

 

Then I have an html file:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<script type="text/javascript" src="get.js"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="input">
<form name="form1">
Keyword:
<input type="text" name="keyword" onkeyup="showUser(this.value);"/>
</form>

</div>
<div id="get">

</div>
<div id="time">
<script type="text/javascript">
show();
</script>

</div>
</body>
</html>

 

On the left side of the page at the very top in the input id it shows keyword and then a text box. Then on the left it shows the time. The problem is that even though it shows the time on the left it is not where I want it. I want it to be on the same line as the keyword and text box but it is about 3 lines down. Any help is appreciated.

Link to comment
Share on other sites

Yeah it was confusing me as well. I have tried several things and nothing seems to fix this issue. Does anyone have any other suggestions? By the way thanks for your help f1fan. If someone might have some spare time and want to copy the pages and try to get them to display correctly it would be appreciated. Maybe I can help with something else

Link to comment
Share on other sites

Ah hah! I think I figured it out. I just copied your code to one of my sites and tested it. It wasn't displaying properly at first. Then I added display: inline; to the form tag and it worked. This is my exact code (changed a little, because I don't have your js file):

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<style type="text/css">
body {
margin:0 auto;
width:800px;
height:100%;
border:1px solid #000000;
}
#input {
display: inline;
}
#get {
display: inline;
}
#time {
display: inline;
}
</style>
</head>

<body>

<div id="input">
<form name="form1" style="display:inline;">
Keyword:
<input type="text" name="keyword"/>
</form>

</div>
<div id="get">
get
</div>
<div id="time">
time
</div>
</body>
</html>

Link to comment
Share on other sites

Try this for your CSS:

body {
position: relative;
top: 0px;
left: 0px;
margin:0 auto;
width:800px;
height:100%;
border:1px solid #000000;
}
#input {
display: inline;
}
#get {
display: inline;
}
#time {
position: absolute;
top: 0px;
right: 0px;
display: inline;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.