I want to make the whole view linkable.
This is my rewrite rule:
<div class="news_column_wrapper z-depth-1 card">
<div class="news_column_images card-image">[field_images]</div>
<div class="news_column_content_wrapper">
<div class="news_column_created"><i class="fa fa-clock-o"></i> [created]</div>
<div class="news_column_title">[title]</div>
</div>
</div>
This is my view field screenshoot, I want to make the whole box clickable:
I have tried with
<div class="news_column_wrapper z-depth-1 card">
<a href="[path]">
<div class="news_column_images card-image">[field_images]</div>
<div class="news_column_content_wrapper">
<div class="news_column_created"><i class="fa fa-clock-o"></i> [created]</div>
<div class="news_column_title">[title]</div>
</div>
</a>
</div>
but nothing happens. How can I achieve that?
I think it's more an HTML issue than a Drupal one.
The <a> tag is an inline tag, and you have placed <div> tags inside of it. The natural display of the <a> tag will make that, only the text will be clickable.
What you can do is use CSS to make the <a> a block element, therefore, making the clickable zone extend to the whole block.
First add a class to your link:
<a class='block_link'>
<h2>My title</h2>
<div>My content</div>
</a>
Then, in your CSS, make the <a> tag displaying like a block.
a {
display:block;
}
That should do the trick.
Related
Currently, I have a box which has some text inside it. Currently, the link is only applied to some text as below:
<div class="row text-banner-blocks">
<div class="col-sm-4 header-text-banner text-center">
<!-- gray-border -->
<div class="box">
<h3>Free delivery worldwide*</h3>
<a href="#">
*More info here
</a>
</div>
</div>
This is how it appears on the site:
https://snag.gy/sbC421.jpg
However, I want the whole link placed in the whole box and as with HTML I just place the tag inside the tag but I seem to lose all the styling and the padding goes I think? Code:
<div class="row text-banner-blocks">
<div class="col-sm-4 header-text-banner text-center">
<!-- gray-border -->
<a href="#">
<div class="box">
<h3>Free delivery worldwide*</h3>
<br/>
*More info here
</div>
</a>
</div>
This is how it looks after:
https://snag.gy/KZzSUv.jpg
Any help is greatly appreciated!
I think you are referencing the .box div using a css selector that requires the parent element to be a div
so you might have to change the css for the box element to something like
a > .box {
/* styles */
}
check this image for more info
Decided to do it with JavaScript inside using the below for the parameters of the div tag:
onclick="document.location='#'"
This solution is neater for what I am after and as I am using several style sheets it was difficult to spot the culprit.
This is my current code
.tag-container.bottom-border.col-middle
h1.text-center {{ tag.name }}
button.btn.btn-follow.pull-right(ng-hide="hasFollowed" ng-click="tagArticles.followTag()") Follow
I want to make the tag.name in the middle, and the button in the right, but it didn't display correctly. How should I structure these two part? What css should I use?
Thanks.
Update
This is the simplified code about basic html
<row>
<div>
<h1> Tag name</h1>
</div>
<div class="pull-right">
<button>Follow</button>
</div>
</row>
Feel free to work on it. Thanks
If you want to stick to pure bootstrap styles, something like this would work:
<div class="row">
<div class="col-md-10 col-md-offset-1">
<h1 class="text-center">Tag name</h1>
</div>
<div class="col-md-1 text-center">
<button class="btn btn-follow " style="margin-top: 1.5em;">Follow</button>
</div>
</div>
You'll need some extra styling to vertically center the button (to replace the inline style adding 1.5em margin to the top).
Also that styling centers the button below the h1 in mobile breakpoints ... that may or may not be what you're after.
I'm building a webpage, the landing page has two portals. I would like to use jombotrons to be used as the portals. I would like to have two jumbotrons side by side. I thought if I put them inside a row div, and gave them col-mid-6 class this would give me the desired affect. However, they just span across the page, and then stack. Any help would be very much appreciated. I'm very new to css and bootstrap.
<div class="row">
<div class="container">
<div class="jumbotron text-center col-mid-6">
<h1>Become Awesome</h1>
<p>Here you will learn how to become awesome.</p>
<a class="btn btn-danger pull-right" href="{% url 'awesome_info' %}">More Info</a>
</div>
<div class="jumbotron text-center col-mid-6">
<h1>Here you will learn how to become super rad.</h1>
<p>Tubular dude.</p>
<a class="btn btn-success" href="{% url 'rad_info' %}" role="button">More Info</a>
</div>
</div>
</div>
The correct class is col-md-6.
With that your jumbotron will be equal widths like in here
If you want the height to be equal too, give your container class a css property such as:
.container{
display: flex
}
For the result to be like this
You have a typo in your divs. Bootstrap calls for a col-md-6 class, not a col-mid-6 class.
<div class="jumbotron text-center col-md-6"></div>
You should put your div.container into a div.row then, write this css property
.container{
display: flex
}
Currently i have this setup on a page, there are three buttons in a button group acting as tab toggle buttons and below them is a bootsrap well having tab pages. Is there a way to have the button group become part of the well, so it sits in the center of the top edge of the well?
I have tried code from here: Bootstrap - Adding legend to well but didnt work.
Here is img of current setup
Code is simple
<div style="text-align:center">
<div id="tab" class="btn-group" data-toggle="buttons-radio">
<a style="padding:9px;font-size:16px" href="#tdel" class="btn active" data-toggle="tab">Delegations</a>
<a style="padding:9px;font-size:16px" href="#tind" class="btn " data-toggle="tab">Individuals</a>
<a style="padding:9px;font-size:16px" href="#tobs" class="btn " data-toggle="tab">Observers</a>
</div>
</div>
<div class="well">
<div class="tab-content">
<div class="tab-pane" id="tind">
</div>
<div class="tab-pane" id="tobs">
</div>
<div class="tab-pane" id="tdel">
</div>
</div>
</div>
Fiddle: http://jsfiddle.net/mikeyfreake/CbNfa/2/
Place the buttonset div inside the well div.
Fiddle for reference.
You can also margin-top: -15px; in your CSS sheet to further move it up to sit in the center top part of the well. Hope this helps!
(Before I start, yes I have asked a similar question before; unfortunately due to new information being added, the markup has completely changed for the worse, and it's now impossible for me to figure out.)
I have some very ugly markup generated by a Drupal view. Because many of the class names can be used in multiple places, in various levels of the hierarchy (for example, the first view-content/view-grouping/view-grouping-header needs to float left (or at least the contents of it do for the headshot image, but the other view-grouping-header elements need to display to the right of the image), I can't just address the class names; I need to get the full hierarchy. I'm having some trouble with that... (I know someone is going to come along and say, "but you can add classes to fields in Drupal views; why not do that?" Well, you can if you're displaying individual fields, but in this case I need to group by 5 of the 6 fields that are displayed, and when you group by a field you set the field itself to be excluded from the display, which means any custom classes you add to the field are ignored. The only thing you can do stylewise with grouping is apply a single class to all rows, which I've done but doesn't help in this case.)
<div class="view-clone-of-speaker-list">
<div class="view-content">
<div class="view-grouping">
<div class="view-grouping-header">
<div id="file-741" class="file file-image file-image-jpeg
contextual-links-region">
<div class="content">
<img src="johndoe.jpg" width="180" height="180" alt="" />
<!-- this img needs to float left -->
</div>
</div>
</div>
<div class="view-grouping-content">
<div class="view-grouping">
<div class="view-grouping-header">
John Doe
<!-- this view-grouping-header a needs to be styled differently
than the one the next level down (view full profile) -->
</div>
<div class="view-grouping-content">
<div class="view-grouping">
<div class="view-grouping-header">
Freelance consultant
</div>
<div class="view-grouping-content">
<div class="view-grouping">
<div class="view-grouping-header">
Path to Purchase Institute
</div>
<div class="view-grouping-content">
<div class="view-grouping">
<div class="view-grouping-header">
<a href="/speaker/john-doe">
view full profile ></a>
</div>
<div class="view-grouping-content">
<h3>Sessions:</h3>
<div class="views-row views-row-1 views-row-odd views-row-first">
<div class="views-field views-field-title-1">
<span class="field-content">
Keynote Address 2
</span>
</div>
</div>
<div class="views-row views-row-2 views-row-even views-row-last">
<div class="views-field views-field-title-1">
<span class="field-content">
Keynote Address 1
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is what I've tried, for example, to get the outer view-grouping - I want to put a border around the entire thing:
.view-clone-of-speaker-list.div.view-content.div.view-grouping {
border: 1px solid #a8a8a8;
}
But according to Firebug the element is not getting that style.
Here's the desired outcome; I don't need help (I don't think!) with the actual style code; I just need a hand figuring out how to address the correct elements given how frakkin' awfully they're nested.
A period on a selector means "class"; div.myClass means a div with a class of myClass. div.myClass.div.myOtherClass doesn't mean anything.
I think what you want is
div.view-clone-of-speaker-list>div.view-content>div.view-grouping {
border: 1px solid #a8a8a8;
}
That means "a div with a class of view-grouping, which is a child of a div with a class of view-content, which is a child of a div with a class of view-clone-of-speaker-list".