I'm using Angular 4, and i want to append some static html that is comming from database. Content have some 'anchor tag' which is hold routerLink attribute. When i show in template via [innerHTML], it's removing 'routeroutlet' attribute from anchor tag. How it is possible to add 'routerLink'? Which is work properly for navigation page?
My content is given below, which is comming from database:
<div class="row banner-item">
<div class="col-md-9 col-sm-9 col-xs-12">
<img alt="banner-image" class="banner-image" src="assets/images/banner-img1.jpg"/>
</div>
<div class="col-md-3 col-sm-3 col-xs-12 banner-image">
<img alt="banner-image" class="banner-image" src="assets/images/banner-img3.jpg"/>
<img alt="banner-image" class="banner-image" src="assets/images/banner-img2.jpg"/>
</div>
</div>
Related
I have created a website through bolt blogger template theme which is an XML document and I have created a separate file folder called Images and put all those png images in that.
My file path is: F:\BackupTheme\BackUp1\Images
I have added these below-given HTML codes inside the theme but it still showing the broken image and I cleared all those cache memories in my chrome browser also but no luck.
My html code would be like:
<div class="col-md-6 col-xs-12 col-sm-6">
<div class="mgn-b">
<div class="col-xs-3">
<img src="../../Images/wifi.png" class="img-responsive center-block img-p" alt="WiFi" title="WiFi"/>
</div>
<div class="col-xs-3">
<img src="../../Images/water.png" class="img-responsive center-block img-p" alt="Drinking Water" title="Drinking Water"/>
</div>
<div class="col-xs-3">
<img src="../../Images/air-conditioner.png" class="img-responsive center-block img-p" alt="Air Conditioner" title="Air Conditioner"/>
</div>
<div class="col-xs-3">
<img src="../../Images/kitchen.png" class="img-responsive center-block img-p" alt="In House Kitchen" title="In House Kitchen"/>
</div>
</div>
</div>
I'm expecting png images to be displayed but the actual result is a broken image.
Consider the below Angular 2 Template code :
<div *ngIf="artist">
<header class="artist-header">
<div *ngIf="artist.images.length > 0">
<img class="artist-thumb img-circle" src="{{artist.images[0].url}}">
</div>
<h1>{{artist.name}}</h1>
<p *ngIf="artist.genres.length > 0">
Genres : <span *ngFor="let genre of artist.genres">{{genre}}</span>
</p>
</header>
<div class="artist-albums">
<div class="row">
<div class="col-md-3" *ngFor="let album of albums">
<div class="card bg-faded card-body album">
<div *ngIf="album.images.length > 0">
<img class="album-thumb img-thumbnail" src="{{album.images[0].url}}">
<h4>{{album.name}}</h4>
<a class="btn btn-default btn-block" routerLink="/album/{{album.id}}">Album Details</a>
</div>
</div>
</div>
</div>
</div>
</div>
In spite of applying class="col-md-3", all divs are appearing in a new line vertically. Below is the image shown. I want that 3 div should appear horizontally in one line. What's need to be changed within the above code?
If the whole code you posted is looped to display all these images, each of the col-md-3 is in a seperate row div, which creates a linebreak each time. So try to make the loop inside that row div, only for the col-md-3 elements.
Add the other bootstrap options to the div:
col-lg-3 col-md-3 col-sm-3 col-xs-3
Be sure that you do not have any margins or haven't override the default width from bootstrap using "!important" flag.
Try to see the live CSS using "inspect element" option in your browser and try to change the data there so you can figure out what is going on.
I am brand new to coding and have not been able to determine why two seemingly identical pieces of code do not work the same. This exercise involves simply making a picture appear on a web page. Easy enough, but I do not see why the same code only works one out of two times.
This code works:
<div class="col-sm-6">
<div class="well text-center">
<div>
img class="img-responsive" src="http://pre10.deviantart.net/1d23/th/pre/i/2013/070/1/e/grumpy_cat_by_bwcopy-d5xod2v.jpg"
</div>
While this code does not:
<div class="col-sm-6">
<div class="well text-center">
<div>
img class="img-responsive" src="https://img.buzzfeed.com/buzzfeed-static/static/2015-04/21/16/enhanced/webdr05/enhanced-31550-1429646952-7.jpg"
</div>
I checked the source for the non-working photo and it is valid. (Check it yourself if you like ultra-cute puppies).
What am I not seeing? (besides the puppy picture, obviously).
Thanks.
You are not using the img tag, you are just writing plain text.
Change to this (notice the brackets):
<img class="img-responsive" src="http://pre10.deviantart.net/1d23/th/pre/i/2013/070/1/e/grumpy_cat_by_bwcopy-d5xod2v.jpg" />
First and 2nd code snippets look the same, no reason either of them should work.
try this
<div class="col-sm-6">
<div class="well text-center">
<div>
<img class="img-responsive" src="http://pre10.deviantart.net/1d23/th/pre/i/2013/070/1/e/grumpy_cat_by_bwcopy-d5xod2v.jpg">
</div>
or this:
<div class="col-sm-6">
<div class="well text-center">
<div>
<img class="img-responsive" src="https://img.buzzfeed.com/buzzfeed-static/static/2015-04/21/16/enhanced/webdr05/enhanced-31550-1429646952-7.jpg">
</div>
I have the following Struts2 code which generates a list of shippers. It only shows after the user choses the type of shipment (the hidden class is removed by JavaScript).
<div class ="showIfNotOther hidden">
<div class="row">
<div class="col-xs-12 rowsecthead" id="shipperInfoHeader"><s:text name="shipperInfo"/></div>
</div>
<s:iterator value="chosenShipperViewList" status="status">
<div class="row small-line-height">
<div class="col-sm-2 col-xs-12 "><label for='<s:property value="%{'deleteShipper'+#status.index}" />' class="pull-right"><s:text name="deleteShipperInfo"></s:text>:</label></div>
<div class="col-sm-3 col-xs-12 text-left">
<s:url var="deleteLink" action="shipment_deleteShipperFromChosenShipperViewList"></s:url>
<s:a id="%{'deleteShipper'+#status.index}" href="%{deleteLink}"> <img src="/llr/theme/delete.gif" width="16" height="16" alt="Map Red X" ></s:a>
</div>
<hr>
</div>
</s:iterator>
The Struts2 code generates the following HTML which has each "Delete Shipper Info:" label associated with each <a> element by an id (deleteShipper0, deleteShipper1, etc.) which is what I understand is required to be 508 compliant.
<div class ="showIfNotOther hidden">
<div class="row">
<div class="col-xs-12 rowsecthead" id="shipperInfoHeader">Shipper Information</div>
</div>
<div class="row small-line-height">
<div class="col-sm-2 col-xs-12 "><label for='deleteShipper0' class="pull-right">Delete Shipper Info:</label></div>
<div class="col-sm-3 col-xs-12 text-left">
<a id="deleteShipper0" href="/llr/shipment_deleteShipperFromChosenShipperViewList.action?organizationName=Mercy"><img src="/llr/theme/delete.gif" width="16" height="16" alt="Map Red X" ></a>
</div>
<hr>
</div>
<div class="row small-line-height">
<div class="col-sm-2 col-xs-12 "><label for='deleteShipper1' class="pull-right">Delete Shipper Info:</label></div>
<div class="col-sm-3 col-xs-12 text-left">
<a id="deleteShipper1" href="/llr/shipment_deleteShipperFromChosenShipperViewList.action?organizationName=Nuclear"><img src="/llr/theme/delete.gif" width="16" height="16" alt="Map Red X" ></a>
</div>
<hr>
</div>
When I put the HTML in the W3C Markup Validation Service I get the error
The for attribute of the label element must refer to a non-hidden form control.
Is the HTML really not compliant (and if it isn't, how do I fix it), or is this just a bug in the W3C Markup Validation Service?
As defined by the W3 definition of a label:
The label element represents a caption for a form control.
You are currently using a label tag for a link, not for a form control, which is your first error.
And yes, it is right:
The for attribute of the label element must refer to a non-hidden form control.
When navigating with a screenreader you have to be able to go from the label to the form control. But in your case, it seems that both your label and your future form control (once you will have replaced the link with a form control) will be in the same hidden div. So you won't have to care about such remark.
But I think that using a form control will remove this comment from the W3 validator as it does not handle CSS.
I´m using the bootstrap grid system with full-width and I want to have a section, where I have four img-elements with equal margin and the margin should be responsive. The section is in the center of the page.
I could say for every img-element margin-right: 20px or something like this, but can I get this also responsive?
<div class="row" id="content_services">
<div class="col-md-offset-2 col-md-8">
<section id="services_section">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
</section>
</div>
</div><!-- END ROW CONTENT_SERVICES -->
The stylesheet:
#services_section{
}
#services_section img{
height: 275px;
width: 275px;
display: inline;
}
if its only ever going to be 4 elements - use a nested column structure. Each image will display across the page in a single row across the screen on medium and large viewports, will display in pairs on small viewports and will stack vertically on small viewports. You will still need to style the images to display in the center of each (either with a text-center class on the parent div as I have done or via css on each img). If you need to alter the number of images - remember that the magic number is 12 - each column can be divided into 12 columns so you can alter the sizings for different numbers of image elements.
Also just note that a section semantically requires a heading (h1 - h6 - which defines its title ) within its structure to be valid html5. Hope this helps, Gavgrif
<div class="row" id="content_services">
<div class="col-md-offset-2 col-md-8 text-center">
<section id="services_section">
<div class="col-md-3 col-sm-6">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
</div>
<div class="col-md-3 col-sm-6">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
</div>
<div class="col-md-3 col-sm-6">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
</div>
<div class="col-md-3 col-sm-6">
<img src="pictures/test.jpg" alt="Test" class="img-responsive">
</div>
</section>
</div>
</div><!-- END ROW CONTENT_SERVICES -->