Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
add <div> before each hr element
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chad Meyers  
View profile  
 More options Jun 7 2012, 10:09 am
From: Chad Meyers <starlingdesig...@gmail.com>
Date: Thu, 7 Jun 2012 07:09:19 -0700 (PDT)
Local: Thurs, Jun 7 2012 10:09 am
Subject: add <div> before each hr element

I have the the folowing html

<p> .... </p>
<p> .... </p>
<hr />
<p> .... </p>
<hr />
<p> .... </p>
<p> .... </p>

and inside the <p>'s there are floated images, and they are messing with
the margin set on the <hr />'s  I can fix this by adding a simple <div
class="clear"></div> before each <hr />.

I can't seem to figure out how.  I have tried element.inject,replace,grab
but none seem to work for me.  any help?

I thought something like this;
var clearDiv = new Element('div.clear');
$$('hr').inject(clearDiv, 'top')

Why? think WYSIWYG client input. ['what's a div?']


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Thompson  
View profile  
 More options Jun 7 2012, 10:20 am
From: Philip Thompson <philthath...@gmail.com>
Date: Thu, 7 Jun 2012 09:20:58 -0500
Local: Thurs, Jun 7 2012 10:20 am
Subject: Re: [Moo] add <div> before each hr element

On Thu, Jun 7, 2012 at 9:09 AM, Chad Meyers <starlingdesig...@gmail.com>wrote:

<hr/> is not a block-level element, so I don't believe you can insert a div
at the "top" of the <hr/>. You could add it "before" the <hr/> though. Why
don't you just add some CSS to your <hr/>:

hr {
    clear: both;

}

Or I also think you can add some CSS to your paragraphs (which I think will
fix the floating problem):

p {
    overflow: auto;

}

Why? think WYSIWYG client input. ['what's a div?']


No clue what you're asking here.

Cheers,
~Philip


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chad Meyers  
View profile  
 More options Jun 7 2012, 10:44 am
From: Chad Meyers <starlingdesig...@gmail.com>
Date: Thu, 7 Jun 2012 07:44:05 -0700 (PDT)
Local: Thurs, Jun 7 2012 10:44 am
Subject: Re: add <div> before each hr element

I was hoping to do it via css, but see no option.

css is
hr {
margin: 2em 0px;
clear: both;

}

The problem I have is that, the <img> inside the <p> is floated left or
right, and hangs below the <p> So the <hr> sites against the <img> not 2em
below.
the actual page in question is this
one http://www.snairbrothershotrods.ca/currentProjects.php

This page content is generated by the client through a WYSIWYG editor
(CKEditor) and inserting <div>'s is beyond their capability.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Onnis  
View profile  
 More options Jun 7 2012, 11:00 am
From: "Steve Onnis" <st...@cfcentral.com.au>
Date: Fri, 8 Jun 2012 01:00:49 +1000
Local: Thurs, Jun 7 2012 11:00 am
Subject: RE: [Moo] Re: add <div> before each hr element

If your images are floated but your <p> tags are not then you will always have trouble. You need to float your <p> tags also and everything else should come into line

From: Chad Meyers [mailto:starlingdesig...@gmail.com]
Sent: Friday, 8 June 2012 12:44 AM
To: mootools-users@googlegroups.com
Subject: [Moo] Re: add <div> before each hr element

I was hoping to do it via css, but see no option.

css is

hr {

            margin: 2em 0px;

            clear: both;

}

The problem I have is that, the <img> inside the <p> is floated left or right, and hangs below the <p> So the <hr> sites against the <img> not 2em below.

the actual page in question is this one http://www.snairbrothershotrods.ca/currentProjects.php

This page content is generated by the client through a WYSIWYG editor (CKEditor) and inserting <div>'s is beyond their capability.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chad Meyers  
View profile  
 More options Jun 7 2012, 11:33 am
From: Chad Meyers <starlingdesig...@gmail.com>
Date: Thu, 7 Jun 2012 08:33:47 -0700 (PDT)
Local: Thurs, Jun 7 2012 11:33 am
Subject: Re: [Moo] Re: add <div> before each hr element

I don't think thats quite right either.  Thank for the help.  In the end, I
just edited the source files of CKEditor so when you insert an <hr />
element, it will insert the div before.  It's a bit of a hack but it works.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Thompson  
View profile  
 More options Jun 7 2012, 1:39 pm
From: Philip Thompson <philthath...@gmail.com>
Date: Thu, 7 Jun 2012 12:39:41 -0500
Local: Thurs, Jun 7 2012 1:39 pm
Subject: Re: [Moo] Re: add <div> before each hr element

Instead of hacking it, try a non-hackable, CSS (but sorta hackish =D)
solution:

http://www.quirksmode.org/css/clearing.html

~Philip

On Thu, Jun 7, 2012 at 10:33 AM, Chad Meyers <starlingdesig...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chad Meyers  
View profile  
 More options Jun 8 2012, 12:26 pm
From: Chad Meyers <starlingdesig...@gmail.com>
Date: Fri, 8 Jun 2012 09:26:01 -0700 (PDT)
Local: Fri, Jun 8 2012 12:26 pm
Subject: Re: add <div> before each hr element

OK, I am not happy with my hack of CKEditor.  I would like to come back to
replacing (or adding to) the hr elements on the page.


Can MooTools not just find each <hr /> and replace it with "<div
class="clear"></div><hr />" even if I had to wrap the element like <div
class="hrClear"><hr /></div>

I put together a fiddle with what I currently have.  The catch is you can
not edit the html, as it is being generated by the client via a WYSIWYG
editor. So the solution has to be css and/or javascript.

The goal, always keep a 2em margin above and below the HR, whether the text
wraps passed the floated image or not.

http://jsfiddle.net/8ACRP/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sanford Whiteman  
View profile  
 More options Jun 8 2012, 12:53 pm
From: Sanford Whiteman <sa...@figureone.com>
Date: Fri, 8 Jun 2012 12:53:34 -0400
Local: Fri, Jun 8 2012 12:53 pm
Subject: Re: [Moo] Re: add <div> before each hr element
 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chad Meyers  
View profile  
 More options Jun 8 2012, 1:21 pm
From: Chad Meyers <starlingdesig...@gmail.com>
Date: Fri, 8 Jun 2012 10:21:13 -0700 (PDT)
Local: Fri, Jun 8 2012 1:21 pm
Subject: Re: [Moo] Re: add <div> before each hr element

I tried that too, but if you have multiple paragraphs you run into trouble.

http://jsfiddle.net/8ACRP/4/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sanford Whiteman  
View profile  
 More options Jun 8 2012, 1:27 pm
From: Sanford Whiteman <sa...@figureone.com>
Date: Fri, 8 Jun 2012 13:27:59 -0400
Local: Fri, Jun 8 2012 1:27 pm
Subject: Re: [Moo] Re: add <div> before each hr element

> I tried that too, but if you have multiple paragraphs you run into trouble.
> http://jsfiddle.net/8ACRP/4/

No trouble at all.

http://jsfiddle.net/8ACRP/5/

I can't account for every possible markup variation, though, there
have to be known expectations.

-- S.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chad Meyers  
View profile  
 More options Jun 8 2012, 3:19 pm
From: Chad Meyers <starlingdesig...@gmail.com>
Date: Fri, 8 Jun 2012 12:19:28 -0700 (PDT)
Local: Fri, Jun 8 2012 3:19 pm
Subject: Re: [Moo] Re: add <div> before each hr element

Sanford Whiteman, You are my hero!!! I can't thank you enough.  I have
never seen that type of css selector (googling now)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sanford Whiteman  
View profile  
 More options Jun 8 2012, 7:12 pm
From: Sanford Whiteman <sa...@figureone.com>
Date: Fri, 8 Jun 2012 19:12:28 -0400
Local: Fri, Jun 8 2012 7:12 pm
Subject: Re: [Moo] Re: add <div> before each hr element

> Sanford Whiteman, You are my hero!!! I can't thank you enough.  I have
> never seen that type of css selector (googling now)

Happy to help, have fun!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »