Yii Framework Forum: Clistview Wrapping <A>, Weird Behaviour - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Clistview Wrapping <A>, Weird Behaviour Rate Topic: -----

#1 User is offline   Reolbox 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 13-April 11

Posted 14 November 2012 - 05:58 AM

Well hello folks!

I have this weird mystery:

So i am using CListview for rendering a dataprovider list. And i want to make each item (rendered by _view) fully clickable as a href.

this is my _view file:

<div class="row" >
    <div class="span4">MY CONTENT</div>
</div>


adding the <a>:

<a href="a link">
<div class="row" >
    <div class="span4">MY CONTENT</div>
</div>
</a>


Using the browser's inspectors gives me this weird result:

<a href="a link">
</a>
<div class="row" >
    <div class="span4">MY CONTENT</div>
</div>


How can that happen? I am using LESS as css preprocessor and bootstrap js/css.

Thank you guys very much!
--
My portfolio
I am looking for dedicated backbone programmer.
0

#2 User is offline   xahgmah 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 08-October 12
  • Location:Ukraine, Kharkiv

Posted 14 November 2012 - 06:13 AM

<a href="a link"> must be a block element. Add this properties in your css
0

#3 User is offline   Reolbox 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 13-April 11

Posted 14 November 2012 - 07:12 AM

View Postxahgmah, on 14 November 2012 - 06:13 AM, said:

<a href="a link"> must be a block element. Add this properties in your css


Thanks for the quick reply!

Yes i added "display: block" to the <a> element. But still the same issue.
--
My portfolio
I am looking for dedicated backbone programmer.
0

#4 User is offline   xahgmah 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 08-October 12
  • Location:Ukraine, Kharkiv

Posted 22 November 2012 - 05:04 AM

View PostReolbox, on 14 November 2012 - 07:12 AM, said:

Thanks for the quick reply!

Yes i added "display: block" to the <a> element. But still the same issue.

Hm... maybe bootstrap.css overrides your property. Add !important in end of the line with link's property
0

#5 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,360
  • Joined: 12-October 09
  • Location:Croatia

Posted 22 November 2012 - 05:13 AM

Wrapping block level elelments (DIV) with a link (A) is introduced only in HTML5, previously it was not possible/working... so I guess you are using a browser that does not "know" HTML5

Previously, I was solving this by using SPAN elements instead of DIV and then in the CSS for those SPANs would set "display:block" so they would simulate a DIV element. This way you would have a link (A) wrapping in-line elements (SPAN), and that was allowed and working.
Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users