Forums / Templates, Stylesheets, Page Layout / <br/> vs <br class="clearBoth" />

<br/> vs <br class="clearBoth" />

Started by sendmenews on 10 Oct 2011, 6:48 PM · Views: 2,510

Results 1 to 11 of 11
10 Oct 2011, 6:48 PM
#1
sendmenews avatar

sendmenews

Zen Follower

Join Date:
May 2008
Posts:
122
Plugin Contributions:
0

<br/> vs <br class="clearBoth" />

At times when I have wanted to add space in some of the tpl_ ...I noticed that adding another "<br class="clearBoth" />" would provide me with the space that I wanted on any given page. For example if I wanted to move a button down or if I wanted to place more space between a description and the free shipping icon etc.

Well I just started thinking that might be a mistake and mess up things, even though every page cosmetically looks okay. Is it okay to be doing that or should I be using <br/> or something totally different.

11 Oct 2011, 1:33 PM
#2
batman42ca avatar

batman42ca

New Zenner

Join Date:
May 2010
Posts:
32
Plugin Contributions:
0

Re: <br/> vs <br class="clearBoth" />

<br class="clearBoth" /> has to do with CSS and the float property. I suspect it's harmless when there is no preceding floated element.

If you want to understand it better, research the "float" and "clear" keywords in a CSS context

11 Oct 2011, 3:05 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: <br/> vs <br class="clearBoth" />

The best way to adjust spacing for page elements is to find the class/id/whatever that apply to the element and edit or add to the stylesheet rules with padding, margins, etc. The possible combinations of tweaks are endless, and we would have to see a specific case live to advise best. You should have Firefox and its Web Developer and/or Firebug extensions for this work. Some other browsers have similar tools.

This avoids widespread PHP file edits which would then have to be copied into all of your new files each time you upgrade.

22 Jul 2021, 3:47 PM
#4
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Re: <br/> vs <br class="clearBoth" />

There is an issue with our product pages on PCs (it's fine on mobile from what I can see.) See this page as an example:
https://www.welsh-lovespoons.co.uk/full-range-of-spoons/two-hearts-in-one-love-spoon-004

On Firefox it shows correctly with the product image on the left, and then the Atrributes block and add to cart on the right with a divider underneath and then the description. From what I can see this is the code that seperates the attributes / Add to Cart section and the description section:

<br class="clearBoth" />  <hr id="product-divider" />

But when using Chrome or Microsoft Edge, the divider and description text are squashed on the right side of the attributes block rather than beneath it. Is there any code I can add to this section so that it shows correctly on all browsers and also importantly doesn't interefere with how it works on mobiles? I am no expert but can make simple changes to files etc and hope this is quite simple. Thanks for any help.

22 Jul 2021, 3:50 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,735
Plugin Contributions:
56

Re: <br/> vs <br class="clearBoth" />

Try putting a <br> after the br with clearboth, i.e.

<br class="clearBoth" /><br><hr id="product-divider" />

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Jul 2021, 4:19 PM
#6
bonheddwr avatar

bonheddwr

Zen Follower

Join Date:
Jun 2007
Location:
Cymru
Posts:
124
Plugin Contributions:
0

Re: <br/> vs <br class="clearBoth" />

Perfect. That's done the trick! Thank you.

22 Jul 2021, 4:26 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,735
Plugin Contributions:
56

Re: <br/> vs <br class="clearBoth" />

Yep we had to do that on the checkout_shipping page in responsive_classic too. Glad you're all set.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Jul 2021, 4:54 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: <br/> vs <br class="clearBoth" />

Depending on the browser (think Chrome), having the clearBoth on a <br> tag might not do the trick. I normally use the construct <div class="clearBoth"></div> instead.

22 Jul 2021, 9:27 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,735
Plugin Contributions:
56

Re: <br/> vs <br class="clearBoth" />

That is certainly more elegant.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

23 Jul 2021, 11:26 AM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: <br/> vs <br class="clearBoth" />

lat9:

Depending on the browser (think Chrome), having the clearBoth on a <br> tag might not do the trick. I normally use the construct <div class="clearBoth"></div> instead.

swguy:

That is certainly more elegant.
Though typically the <div> tag also comes with its own CSS characteristics. Might consider a classed <span> tag instead if there is some unusual visual response/action when using a <div> tag/wrapper.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

23 Jul 2021, 5:58 PM
#11
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,890
Plugin Contributions:
20

Re: <br/> vs <br class="clearBoth" />

mc12345678:

Though typically the <div> tag also comes with its own CSS characteristics. Might consider a classed <span> tag instead if there is some unusual visual response/action when using a <div> tag/wrapper.All should keep in mind that clear:both will only work with an element that is next to floated one.

Clear has no effect on in-line blocks.

https://www.w3schools.com/cssref/pr_class_clear.asp

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com