XPath AND, OR, NOT Conditions: Logical Operators (Examples)

How do you apply logical conditions to get multiple elements, very specific elements, or even exclude elements using XPath? XPath syntax does enable the use of logical operators and, or and not() when searching for elements within your HTML or XML document. To use the logical and and or conditions on obtaining certain elements wrap your syntax in square brackets with a prefixed asterisk. For example, I recently needed to obtain all the tr tags in a data table and only wanted the tr tags if they were nested within a thead or tbody (not a tfoot tag). Therefore, my syntax looked something like this: ...

August 26, 2022 · 3 min · 497 words · Ryan Sheehy

Insert Line Breaks In HTML Code

How do you insert a line break into your HTML code? To insert a line break in HTML use the line break tag <br />. The line break tag is self-closing and doesn’t have a corresponding closing tag, like the paragraph tag does: <p></p>. For example, to include a line break tag in your HTML code insert it where needed, like so: 1 2 3 4 5 6 7 8 9 10 11 12 <html> <body> <p>Jane Doe<br /> 1 Fast Lane<br /> Sydney NSW 2000</p> <p>Dear Jane,</p> <p>Yours sincerely,</p> <p>Ryan Sheehy<br/> Really Important Title<br/> Script Everything.com</p> </body> </html> As you can see line breaks are popular tags to use when you’re writing something like a letter as they can help format aspects within the letter to make it cleaner to read such as addresses and/or signature closes. ...

March 12, 2022 · 2 min · 360 words · Ryan Sheehy

How To Add Blank Line In HTML

How do you add a blank line into HTML? Several ways are possible, with each unique approach depending on your specific use case and what is permissible for you to edit with the HTML. Reasons for why you might need to insert blank lines into your HTML code could be to render it in a PDF. One recent case for myself with a project was having an area at the bottom of a letter where somebody could sign. This might be useful for example when uploading the document to Adobe Sign and having it signed by a couple of parties. ...

January 6, 2022 · 8 min · 1613 words · Ryan Sheehy

How To Add Attributes To Images In Markdown

Markdown is a popular way of writing content and converting it to HTML. Many popular web development sites use it including StackOverflow and GitHub. In fact these very pages that you see here on this sight have been created from source documents written in Markdown. However, one little problem I’ve recently bumped into is appending width and height parameters to the image tags so images can be sized responsively, which can easily be solved applying the following changes via CSS: ...

August 6, 2014 · 4 min · 720 words · Ryan Sheehy

How To Write Fractions Using Only HTML & CSS

Usually when I write fractions I use LaTeX’s command: \frac{x^2 + 3x + 5}{2x} which is easy, neat and when rendered does an awesome job: $$ \frac{x^2 + 3x + 5}{2x} $$ Currently, though I’m designing a simple website for my math students where I’d prefer not use a math renderer (if possible). The reason being that most of the content which is published does not require extensive math notation and therefore the majority of things that I need to show doesn’t need the heavy lifting of a LaTeX engine. ...

November 10, 2012 · 2 min · 379 words · Ryan Sheehy

Add Empty Row In HTML

How do you add an empty row in HTML? To add an empty row in HTML for your table use the code <tr><td colspan="X">&nbsp;</td></tr> otherwise if you want to add an empty row without using a table use the <hr> tag. Here are some examples demonstrating how adding an empty row looks in your HTML code. Add Empty Row In HTML Table To add an empty row in a HTML table insert a table row with a table cell and use the colspan property to span the width of the number of columns in the table. Within the table cell insert an space character so that the browser doesn’t collapse the row. ...

4 min · 793 words · Ryan Sheehy