How to make a stable two column layout in HTML/CSS

Here you go: <html> <head> <title>Cols</title> <style> #left { width: 200px; float: left; } #right { margin-left: 200px; /* Change this to whatever the width of your left column is*/ } .clear { clear: both; } </style> </head> <body> <div id=”container”> <div id=”left”> Hello </div> <div id=”right”> <div style=”background-color: red; height: 10px;”>Hello</div> </div> <div class=”clear”></div> … Read more

Chrome New Tab Page extension steal focus from the address bar

ManifestV3 update This answer is adapted from This has been tested with both Manifest V2 and V3. Tested in Google Chrome 99.0.4844.51 64-bit (Windows 10). Replace the content of focus.js with: if ( !== “?x”) { = “?x”; throw new Error; // load everything on the next page; // stop execution on this … Read more

How can I get text of an element in Selenium WebDriver, without including child element text?

Here’s a general solution: def get_text_excluding_children(driver, element): return driver.execute_script(“”” return jQuery(arguments[0]).contents().filter(function() { return this.nodeType == Node.TEXT_NODE; }).text(); “””, element) The element passed to the function can be something obtained from the find_element…() methods (i.e., it can be a WebElement object). Or if you don’t have jQuery or don’t want to use it, you can replace … Read more

Communication between tabs/windows with same origin [duplicate]

I’m sticking to the shared local data solution mentioned in the question using localStorage. It seems to be the best solution in terms of reliability, performance, and browser compatibility. localStorage is implemented in all modern browsers. The storage event fires when other tabs makes changes to localStorage. This is quite handy for communication purposes. References … Read more

How to place two forms on the same page?

You could make two forms with 2 different actions <form action=”login.php” method=”post”> <input type=”text” name=”user”> <input type=”password” name=”password”> <input type=”submit” value=”Login”> </form> <br /> <form action=”register.php” method=”post”> <input type=”text” name=”user”> <input type=”password” name=”password”> <input type=”submit” value=”Register”> </form> Or do this <form action=”doStuff.php” method=”post”> <input type=”text” name=”user”> <input type=”password” name=”password”> <input type=”hidden” name=”action” value=”login”> <input type=”submit” … Read more

Are single/double quotes allowed inside HTML attribute values?

Yes, both quotes are allowed in attribute values, but you must HTML-escape the quote you’re using as an attribute value delimiter, as well as other HTML-special characters like < and &: function encodeHTML(s) { return s.split(‘&’).join(‘&amp;’).split(‘<‘).join(‘&lt;’).split(‘”‘).join(‘&quot;’).split(“‘”).join(‘&#39;’); } var html=”<label my_attr=””+encodeHTML(attr_value)+'”>Text</label>’; However, you are usually much better off not trying to hack a document together from … Read more