I want my button at the top within the DIV

HomerSimpson
avatar
rank Regular

Regular


Posts: 14
Joined: 2008-05-06

I am trying to position a button at the top within the DIV that contains it but it stubbornly remains in the middle where it wants to be. After playing around a bit here's what I have. Any clues?

.butt1{
Height:47px;
width:100px;
background : grey;
top: 1px; }

form div.g{
width: 280px;
float: right;
vertical-align:top;
padding: 42px;
height: 18px;
margin: 15px 4px 0;
background-color : orange;
}

HomerSimpson
HomerSimpson's picture
rank Regular

Regular


Posts: 14
Joined: 2008-05-06

Whoops, html:

Whoops, html:

   <asp:Button ID="Button1" runat="server" class="butt1" OnClientClick="return ValidateBOX();"
      Style="z-index: 116;" Text="View" />

Caposoft
Caposoft's picture
rank Enthusiast

Enthusiast


Posts: 201
Joined: 2008-03-16

Unfortunately you haven't

Unfortunately you haven't posted the required information, even though this is not the first time your posting. Please make sure you have the complete CSS and html including a doctype. So, just a guess here: Your padding in the div is set to 42px from top, bottom, right and left. Might that cause the problem?

HomerSimpson
HomerSimpson's picture
rank Regular

Regular


Posts: 14
Joined: 2008-05-06

padding

Yes, after experimenting, I removed the padding and it worked.

HomerSimpson
HomerSimpson's picture
rank Regular

Regular


Posts: 14
Joined: 2008-05-06

posit

Here's a little puzzler for me.
I have 2 labels in a div, one floated right and other left. How would I move the left one over to the right a bit in a desired position?

Caposoft
Caposoft's picture
rank Enthusiast

Enthusiast


Posts: 201
Joined: 2008-03-16

with margin-left?

with margin-left?

HomerSimpson
HomerSimpson's picture
rank Regular

Regular


Posts: 14
Joined: 2008-05-06

The best easiest way

The best easiest way possible, I guess. I could put another div within that div and position the that div so that the label goes along for the ride?

Caposoft
Caposoft's picture
rank Enthusiast

Enthusiast


Posts: 201
Joined: 2008-03-16

Why would you want to do

Why would you want to do that? It increases your file size, is not semantic and does not give you any extra advantage.

Please, in the future create an extra thread for each question that you have, not forgetting to mention that posting the full code is essential.

HomerSimpson
HomerSimpson's picture
rank Regular

Regular


Posts: 14
Joined: 2008-05-06

THREAD

I guess I could've started a new thread but since I've already commenced this I'll clarify my point. I just made a suggestion but did say that I'm looking for the best way to solve my quest. Obviously my suggestion is innefficient & creates a larger file. But to put it simply, I just wanted to know how to shift the left label("Purchase Queries") to the right a bit. I'm new here and new to css & html

<div class="pre-head">
  <asp:Label ID="Label12" runat="server" cssclass="second-txt" Style="z-index: 118;" text="Purchase Queries" ></asp:Label>
<asp:Label ID="Label13"  cssclass="first-txt" runat="server" Style="z-index: 118; "Text="data update"> </asp:Label>                   
</div>



.first-txt
{float:right;
height:222;
font-size:medium;
color : red;
width:259px;}

.second-txt
{float:left;
height:222;
font-size:medium;
color : red;
width:123px;
}


form div.pre-head{
  width: 692px;
  float: left;
  padding: 2px;
  height: 28px;
  margin: 15px 4px 0;
  font-size:small;
  background-color : white;
  }

Caposoft
Caposoft's picture
rank Enthusiast

Enthusiast


Posts: 201
Joined: 2008-03-16

ok, it would had made sense

ok,

it would had made sense to start a new thread, since it is a totally different issue.

Looking at your CSS I can say that you did a lot of thinking, but this is not the right way to go about it. But don't worry, I can say from my own experience that forms are the most hated and least documented element.

There are elements to create a form, makes it easier, semantic and more accessible. One element would be the form element that replaces your form div.pre-head, and the label element replaces your txt classes.

We currently had a very interesting thread about it. Maybe you read up on it here, do some googling, and come back for any further issue. Eye-wink