Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<hr /> not styling for Outlook (tested on 2013) #396

Closed
davidhouweling opened this issue Apr 28, 2016 · 16 comments
Closed

<hr /> not styling for Outlook (tested on 2013) #396

davidhouweling opened this issue Apr 28, 2016 · 16 comments

Comments

@davidhouweling
Copy link

How can we reproduce this bug?
Set $hr-border: 4px solid #a4a4a4 and use a <hr />.

You'll notice that it isn't styled in the browser.

What did you expect to happen?
A <hr /> to be styled in accordingly.

What happened instead?
The <hr /> is still a 1px black line.

What email clients does this happen in?
Outlook (tested on 2013)

Possible solution
Use Inky to replace <hr /> with something along the lines of...

<div class="hr">&nbsp;</div>

With the css of

.hr {
  background: #a4a4a4;
  font-size: 4px;
  line-height: 4px;
}

So basically you can still have the original variable, but just parse it and inject accordingly.

@rafibomb
Copy link
Member

Does the style change when you inline it? Or is this client specific for Outlook?

@davidhouweling
Copy link
Author

I set up a little gulp task which runs the build task so that it is inline, and then sends the result to an email address which I am using Outlook to view the content. So my results are based on the production ready markup. What I suggested above was merely what you would implement in the scss files.

@rafibomb
Copy link
Member

rafibomb commented May 6, 2016

Looks like Outlook has spotty support for styling on an HR element. It has been suggested over the years to do something like

<table>
  <tr>
    <td style="background:none; border:dotted 4px #a4a4a4; border-width:4px 0 0 0; height:4px; width:100%; margin:0px 0px 0px 0px; padding-top:10px;padding-bottom:10px;">&nbsp;</td>
   </tr>
</table>

Perhaps we can use Inky to create a structure like this for <hr>'s that has the hr variables assigned to style it. Thoughts?

@rafibomb rafibomb modified the milestones: 2.2.0, 2.1.1 May 6, 2016
@rafibomb
Copy link
Member

I don't love this solution though - we'd need to come up with an alternative tag for an <hr> which is ugly. Does anyone know of a bulletproof way to style <hr>'s in emails?

@iamsankalp
Copy link
Contributor

iamsankalp commented Jun 1, 2016

@rafibomb I just came across this issue. This is what i'm using now-
<spacer size="1" class="hr"></spacer>

Spacer's to the rescue. Bulletproof to my tests so far on Litmus! What do you think?

@rafibomb
Copy link
Member

rafibomb commented Jun 2, 2016

@iamsankalp That is an interesting solution! I'd still like to explore a solution with CSS because most people will use a consistent <hr> style thought the email.

Can you see any reason we wouldn't want to create an Inky tag <hr> vs something custom like <h-rule> or <line> ?

@iamsankalp
Copy link
Contributor

iamsankalp commented Jun 3, 2016

@rafibomb Yeah, this is just a workaround and people will need to define a background color for their .hr class as per my solution. <line> seems a nice semantic name. 👍

If we can get similar thing via Inky, that'd be great.

Just that I think, we can't really use <hr> in final compiled code since outlook treats them way differently.

Meanwhile what'd you suggest for controlling width of <spacer>. Context: let's say i have to give a separator of 40px width only. That too in center of the layout. How do i achieve that easily? Right now, I'm using columns alongside but obviously it's not fixed width.

Thanks,
Sankalp

@rafibomb
Copy link
Member

rafibomb commented Jun 6, 2016

@iamsankalp Ok <line> is nice, maybe <hline> naming is hard 😏

Re: the spacer - Are you looking to create horizontal spacing as well? I typically use columns or padding to do this. Can you share a visual or specific use case?

@iamsankalp
Copy link
Contributor

@rafibomb thanks for getting back. Nope, just vertical spacing but the separator be a fixed width. Like in the image below (Small separator above download badges).

image

@rafibomb
Copy link
Member

rafibomb commented Jun 8, 2016

I see, so an <hr> but with a constrained width and centered?

@iamsankalp
Copy link
Contributor

@rafibomb Right.

@rafibomb
Copy link
Member

Hmm, I'm pretty sure some CSS can do this or ading it into some offset columns that are less than 12 columns wide. Tell me if I'm wrong!

We want the framework to handle common use cases and things that are a pain to do in email

@iamsankalp
Copy link
Contributor

@rafibomb I figured using columns was fine with me for this. Thanks! :)

@axelson
Copy link

axelson commented Jun 22, 2016

Hmm, I'm pretty sure some CSS can do this or ading it into some offset columns that are less than 12 columns wide. Tell me if I'm wrong!

But if we wanted to keep the overall grid at 12 columns then how would you make a offset column that is narrower than the 1 column? Or one that doesn't fall within the 12 columns?

@davidhouweling
Copy link
Author

I think for what you're trying to solve, I would just use a div Ina row and give it a bottom border with a specified width (may also need &nbsp; inside it for outlook.

Back to the original topic, I still think a solution which replaces


is better than creating a separate element as the intended purpose is to fix hr to work for all clients.

@rafibomb
Copy link
Member

Looks like the PR @brandonbarringer added here solves it along with the CSS just committed!

You can follow it here: foundation/inky#46

We'll close this as resolved pending merging foundation/inky#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants