omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    ui.webview.load_html()

    Pythonista
    2
    4
    1997
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Cook92
      Cook92 last edited by

      I'm just fiddling with something....would appreciate some input.
      If I have some HTML code with CSS and put it into ui.webview.load_html() it seems it cannot handle all CSS parameters.
      I don't know the scope of CSS that it can handle, but I found that table properties don't seem to work.

      Simple Example to use as html to pass to load_html():

      <html><style>table {border-width:1px}</style><table><tr><td>This table should have a border</td></tr></table></html>
      

      It won't have a border. At least from what I've tried!

      However, the below method will provide a border, however this is poor way to go about things in html:

      <html><table border = 1><tr><td>This table should have a border</td></tr></table></html>
      

      Is there something I should do to get that working....?

      Also note: ui.Webview itself handles CSS properly if I load an actual webpage (load_url).

      1 Reply Last reply Reply Quote 0
      • Cook92
        Cook92 last edited by

        sorry- it seems I can't delete this.... I answered my own question:
        (hrm...seems I need to read up on my css!)

        {border: 1px solid black;}

        1 Reply Last reply Reply Quote 0
        • dgelessus
          dgelessus last edited by

          My HTML is a little rusty, but I've never seen CSS embedded using a <style> tag before. Have you tried setting the CSS property on the <table> tag directly, or using a <link/> tag in the <head> to use an external CSS file?

          By the way, it seems that you have no <head> or <body> tags. The <style> tag might need to be in the <head>.

          1 Reply Last reply Reply Quote 0
          • Cook92
            Cook92 last edited by

            You're right about all of those things.

            CSS can be used in three ways - externally linked, internal <head><style>...</style>, and in the tag <table style="...">

            For what I'm doing right now- the internal style sheet is sufficient and arguably easier(?). I'm scraping some html and then showing it in webview.
            Could do re.sub but I'm just adding a bunch of stringy html code and that's easy enough!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors