How to have margin-left: 10%; margin-right: 10%; only sometimes??

Discussion in 'ASP .Net' started by Cal Who, May 16, 2010.

  1. Cal Who

    Cal Who Guest

    My website is created so that the width is not fixed. I adapt to the width
    of the browser. If I have a page of text I do something like:

    <div style=" margin-left: 10%; margin-right: 10%;">

    so the text is set off by margins.

    That's nice on my monitor's 1600 pixel wide screen.

    But on a laptop (or as a user option) I'd like to change that to no margins.

    Can you suggest a way of doing that without having two .css files?



    Thanks
     
    Cal Who, May 16, 2010
    #1
    1. Advertising

  2. On May 16, 10:25 pm, " Cal Who" <> wrote:
    > My website is created so that the width is not fixed. I adapt to the width
    > of the browser. If I have a page of text I do something like:
    >
    > <div style=" margin-left: 10%; margin-right: 10%;">
    >
    > so the text is set off by margins.
    >
    > That's nice on my monitor's 1600 pixel wide screen.
    >
    > But on a laptop (or as a user option) I'd like to change that to no margins.
    >
    > Can you suggest a way of doing that without having two .css files?
    >
    > Thanks


    http://groups.google.com/group/micr....aspnet/browse_thread/thread/8e42024fa63c0575
     
    Alexey Smirnov, May 16, 2010
    #2
    1. Advertising

  3. Cal Who

    Cal Who Guest

    "Alexey Smirnov" <> wrote in message
    news:...
    On May 16, 10:25 pm, " Cal Who" <> wrote:
    > My website is created so that the width is not fixed. I adapt to the width
    > of the browser. If I have a page of text I do something like:
    >
    > <div style=" margin-left: 10%; margin-right: 10%;">
    >
    > so the text is set off by margins.
    >
    > That's nice on my monitor's 1600 pixel wide screen.
    >
    > But on a laptop (or as a user option) I'd like to change that to no
    > margins.
    >
    > Can you suggest a way of doing that without having two .css files?
    >
    > Thanks


    http://groups.google.com/group/micr....aspnet/browse_thread/thread/8e42024fa63c0575

    var x;

    if (self.innerWidth) // all except Explorer

    x = self.innerWidth;

    else if (document.documentElement && document.documentElement.clientWidth)//
    Explorer 6 Strict Mode

    x = document.documentElement.clientWidth;

    else if (document.body) // other Explorers

    x = document.body.clientWidth;



    I don't understand what is happening. I debugger to see what is happening
    and I pass through the x = document.documentElement.clientWidth; code. I'm
    running vs2010 and IE8.

    I do do this:

    If (Request.Browser.Browser.Contains("Safari")) Then

    Me.ClientTarget = "uplevel"

    End If

    That would set me to IE6 would it?

    Got any idea what the problem might be?

    Thanks
     
    Cal Who, May 17, 2010
    #3
  4. Cal Who

    Cal Who Guest

    "Alexey Smirnov" <> wrote in message
    news:...
    On May 16, 10:25 pm, " Cal Who" <> wrote:
    > My website is created so that the width is not fixed. I adapt to the width
    > of the browser. If I have a page of text I do something like:
    >
    > <div style=" margin-left: 10%; margin-right: 10%;">
    >
    > so the text is set off by margins.
    >
    > That's nice on my monitor's 1600 pixel wide screen.
    >
    > But on a laptop (or as a user option) I'd like to change that to no
    > margins.
    >
    > Can you suggest a way of doing that without having two .css files?
    >
    > Thanks


    http://groups.google.com/group/micr....aspnet/browse_thread/thread/8e42024fa63c0575

    Since I'm using a master page with this aspx page that contains the div I
    want to change, I'm having trouble using your function since I can't pass it
    the div's ID

    I thought that within the div might call the function like so:

    ..
    ..
    ..
    <script type="text/javascript">

    qqload("QQQ");

    </script>

    </div>

    </asp:Content>

    Instead of "QQQ" I need to have the div's ID.

    But I don't know how to do that!

    What do you think?

    Thanks
     
    Cal Who, May 17, 2010
    #4
  5. Cal Who

    Cal Who Guest

    "Alexey Smirnov" <> wrote in message
    news:...
    On May 16, 10:25 pm, " Cal Who" <> wrote:
    > My website is created so that the width is not fixed. I adapt to the width
    > of the browser. If I have a page of text I do something like:
    >
    > <div style=" margin-left: 10%; margin-right: 10%;">
    >
    > so the text is set off by margins.
    >
    > That's nice on my monitor's 1600 pixel wide screen.
    >
    > But on a laptop (or as a user option) I'd like to change that to no
    > margins.
    >
    > Can you suggest a way of doing that without having two .css files?
    >
    > Thanks


    http://groups.google.com/group/micr....aspnet/browse_thread/thread/8e42024fa63c0575

    I think I'm getting it. I found:
    qqload(document.getElementById('<%=QQQ.ClientID%>'));
     
    Cal Who, May 17, 2010
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    0
    Views:
    471
    John Saunders
    Aug 28, 2003
  2. Nehmo Sergheyev
    Replies:
    1
    Views:
    508
    Andrew Urquhart
    May 9, 2004
  3. =?Utf-8?B?QmlzaG95?=
    Replies:
    0
    Views:
    993
    =?Utf-8?B?QmlzaG95?=
    Dec 28, 2006
  4. Cal Who
    Replies:
    1
    Views:
    433
    Alexey Smirnov
    May 16, 2010
  5. Oran
    Replies:
    2
    Views:
    544
Loading...

Share This Page