Button problem

G

Guest

Hi,
If I place a button on either a Web form or an HTML form, when I run the
page in a browser, the button stretches right across the screen. This happens
with our Enterprise Visual Studio at work & the Web developer Express edition
I have at home.

Has anybody experienced this problem?

Many thanks for any ideas on how to fix it.

Ant
 
J

Jonathan Wood

It doesn't happen for me. Sounds like you have some sort of formatting
issues. Unfortunately, you didn't provide your code so I have nothing to go
on.
 
G

Guest

Thanks for the interest,

The code is quite simple. Here is the Markup:

<body>
<form id="form1" runat="server">

<asp:Button ID="Button1" runat="server" Style="z-index: 100; left:
207px; position: absolute;
top: 171px" Text="Button" />
</form>
</body>



simply dropped a button onto the form. I also tried removing the default
divs to see if that would fix it but it didn't help.

It's strange that it happens on two separate systems running two different
version of ASP, yet nobody else has seen this issue.(?)

Anyway, hope this might help

Many thanks

Ant
 
J

Jonathan Wood

And there's no other CSS styles involved?

I'm not sure what you are seeing but I'd start by removing each element of
the style attribute. Looks like you're using absolute positioning. I don't
think too many people are using that mode I strongly suspect that is related
to what you are seeing.
 
G

Guest

Hi Jonathon,

Absolutely not. No CSS. Apart from "position", left & top there isn't any
css in the project, no css in the head & the markup I pasted is all there is
apart from the simple div tags I took off. Strange eh!

I discovered something though:

When the style position attribute is set to Absolute in conjunction with top
& left attribute as px, it stretches. When I change top & left to % or use
static or relative, it had no issue.

Do you find you have the issue if you use Absolute with px?

Thanks very much for your feedback on this. I'd like to determine if this is
a bug or my setup

Thanks

Ant





This is what I do:

I create a new project,
switch to design mode,
drag a button onto the default page,
run the application
View a button stretched right across my screen.
Tried it with an HTML button to the same effect
 
J

Jonathan Wood

Ant,
Do you find you have the issue if you use Absolute with px?

No, because, as indicated, I never use absolute positioning. <g>

I can try it sometime if I get a chance.
Thanks very much for your feedback on this. I'd like to determine if this
is
a bug or my setup

The way to determine which is to load it in your browser. The browser is
where it needs to work.
 
G

Guest

Hi Jonathan,

You are quite right. It is related to Absolute positioning. Now that I know
what it is I can work around it at least. Many thanks!

I'm surprised that not many people use Absolute. I come from a Windows Form
background & to me, Absolute is very wysiwyg, especially in conjuction with
using the layout functionality. It uses divs & works well. I wonder why
Absolute is not used much(?). But I guess that's a question for another
thread ;)

Many thanks Jonathan for helping work this out.

Cheers
Ant
 
J

Jonathan Wood

FWIW, I come from a Windows form background also (at least, when I was using
VB).

But I just don't find absolute positioning natural, appropriate, or
efficient when we're talking Web pages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top