I am trying to get a make a div which contains a set of tools responsive.I have a side menu below this which I have made responsive. Could someone let me know where would this be wrong.
#tools {
width: 160px;
position: fixed;
display: inline-block;
margin: 0 auto;
line-height: 1.4em;
}
#media only screen and (max-width: 600px) {
#tools {
width: 70%;
}
}
<div id="tools" style="width: 100%">
<table>
<tr>
<td>
<input type="text" id="searchInput" placeholder="Type To Filter" ng-model="search" class="searchMenu">
</td>
<td id=uploadedit>
<button id="upload" onclick="insertIntoDatabase()" class="pinColor"><i class="fa fa-upload fa-2"></i>
</button>
</td>
<td id=impledit>
<button id="implview" onclick="openImplView()" class="pinColor"><i class="fa fa-pencil fa-2"></i>
</button>
</td>
<td>
<button id="home" class="homeButton"><i class="fa fa-home fa-2"></i>
</button>
</td>
<td>
<button id="keep-menu-open" class="pinColor" ng-click="openAndFixMenu"><i class="pinColor"></i>
</button>
</td>
<td>
<button id="open-left" class="toggleButton" ng-click="toggleMenu()"> <i class="fa fa-bars fa-2"></i>
</button>
</td>
</tr>
</table>
</div>
You have a typo in your media query: it should be # instead of ##. Aside from that, you're declaring width: 100% inline which overwrites whatever you've written in a stylesheet, which is why you don't see the result of the query.
Probably best to take the style="100%" from the div, any inline style like this will over-ride whatever is in the stylesheet.
Also in the media query you have
##tools { width: 70%; }
change to
#tools { width: 70%; }
Related
I created a table using bootstrap, and put it in a div of class container-fluid. On a desktop view it looks like this:
In my CSS I used #media in order to determine certain width under which my container-fluid will take 100% of the screen, but still on mobile view, part of the right side of the table is hidden, and I have to horizontally scroll in order to see it. It looks like this:
My relevant html code is:
<div class="container-fluid" id="tableCont">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Product Name</th>
<th title="Quantity of the product" scope="col">Quantity</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Tomato </td>
<td><input type="number" min="1" max="50"></td>
<td><button title="Include product in list">Include</button></td>
<td> <button type="button" class="btn btn-labeled btn-danger">
<span class="fa fa-remove"></span> Remove</button>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Potato</td>
<td><input type="number" min="1" max="50"></td>
<td><button title="Include product in list">Include</button></td>
<td> <button type="button" class="btn btn-labeled btn-danger">
<span class="fa fa-remove"></span> Remove</button></td>
</tr>
My relevant CSS is:
.table {
width: 100%;
}
#tableCont {
margin-top: 0;
height: 400px;
overflow-y: auto;
border: white;
width: 68%;
}
#media (max-width: 600px) {
#tableCont {
width: 100%;
}
}
How can I set the mobile view so the whole width of the table will be visible with no horizontal scrolling?
Try changing width to max-width in media query.
#media (max-width: 600px) {
#tableCont {
max-width: 100%;
}
put this in your head tag Html:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
and on your CSS:
.table {
display: flex;
justify-content: center;
margin: 0 auto;
width: fit-content;
}
and if you want your content to start from the left side and still fit the screen put this code in #tableCont:
#tableCont {
display: inline-block;
float: left;
}
you can solve this problem with CSS grid as well, so if that interests you
visit https://www.w3schools.com/css/css_grid.asp
I've a problem with my page when its minimized, the buttons are not unorganized
<tbody>
<tr ng-if="PlacesOfInterest.length > 0" role="row" class="text-center" ng-repeat="row in PlacesOfInterest | filter: search | limitTo: limit as filterPlaces " ng-cloak>
<td style="vertical-align:middle"><span class="" ng-bind="row.PlaceName"></span></td>
{{row.PlaceName}}
<td><img ng-if="row.PlacePhotos.length > 0" src="{{row.PlacePhotos[0].URL}}" alt="No Image" style="height:150px; width:100%"/></td>
<td>
<span ng-init="max = 200" ng-bind="row.PlaceDescription.slice(0,max)"></span>
<a ng-show="row.PlaceDescription.length > 200 && max == 200" ng-click="max = 10000">... <span class="more-less"> more</span></a>
<a class="more-less" ng-show="max > 200" ng-click="max = 200"> less</a>
</td>
<td>
<div>
<a class="btn btn-sm btn-modify-places btn-min-width">Edit</a>
<a class="btn btn-sm btn-default-places btn-min-width">Specialities</a>
<a class="btn btn-sm btn-delete-places btn-min-width">Delete</a>
</div>
</td>
</tr>
</tbody>
I expect like this same as my page when it maximized
To adjust content in a responsive way you can use css " #media ( )" it allows you to set specific css rules to the page based on its size, this code below for example apply the css when the size was in 800px or less
#media (max-width: 800px){
div a { width: 150px; clear:both;}
}
This code is just a example, if you want, share your css that I'll show the adjust in your own code
there is alot of possibilities with #media see more here https://www.w3schools.com/cssref/css3_pr_mediaquery.asp
Use css flexbox to achieve this. If you are using bootstrap, its d-flex.
.btn {
background: green;
color: #fff;
padding: 1em;
color: #fff;
background-color: #28a745;
border-color: #28a745;
padding: .25rem .5rem;
border-radius: .2rem;
}
.d-flex {
display: flex;
}
.mr-1 {
margin-right: 0.5em;
}
<table>
<tbody>
<tr ng-if="PlacesOfInterest.length > 0" role="row" class="text-center" ng-repeat="row in PlacesOfInterest | filter: search | limitTo: limit as filterPlaces " ng-cloak>
<td style="vertical-align:middle"><span class="" ng-bind="row.PlaceName"></span></td>
{{row.PlaceName}}
<td><img ng-if="row.PlacePhotos.length > 0" src="{{row.PlacePhotos[0].URL}}" alt="No Image" style="height:150px; width:100%" /></td>
<td>
<span ng-init="max = 200" ng-bind="row.PlaceDescription.slice(0,max)"></span>
<a ng-show="row.PlaceDescription.length > 200 && max == 200" ng-click="max = 10000">... <span class="more-less"> more</span></a>
<a class="more-less" ng-show="max > 200" ng-click="max = 200"> less</a>
</td>
<td>
<div class="d-flex">
<a class="btn btn-sm mr-1 btn-modify-places btn-min-width">Edit</a>
<a class="btn btn-sm mr-1 btn-default-places btn-min-width">Specialities</a>
<a class="btn btn-sm btn-delete-places btn-min-width">Delete</a>
</div>
</td>
</tr>
</tbody>
</table>
I am building a website that has the usual social media links in a footer on my page:
They are hosted in an HTML element coded as:
<div class="social">
<table>
<tr>
<td>Tweet </td>
<td>
<div
class="fb-like"
data-href="#Context.Request.Scheme://#Context.Request.Host.ToString()#Context.Request.PathBase#Context.Request.Path"
data-layout="button"
data-action="like"
data-show-faces="true">
</div>
</td>
<td>
<script type="IN/Share" data-counter="right">
</script>
</td>
<td><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark"><img alt="Pin it" src="//assets.pinterest.com/images/pidgets/pin_it_button.png" border="0" /></td>
</tr>
</table>
</div>
How can I force the alignment or padding of the buttons to be consistent?
Alternatively, if I want to use my own icons and hide these is there a standard approach to doing that?
Thanks
Mark
The way this is constructed is wrong! Please use table for data and not for styling. Change it to a div and you'll find that making it mobile responsive is easy.
Try to nest the divs so you can just move your main div and all the sub-divs within it moves along.
Try something like this:
.social { display: inline-block; }
<div id="social-icons">
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
</div>
And to make changes when viewing from a smaller screen - eg; mobile, then use media queries to align the content when a certain device size is reached.
Media Query CSS:
#media screen and (max-width: 480px) {
.social {
display: block;
width: 100%;
}
}
Of course, change the css styling to whichever you prefer.
I would use flex instead of a table layout. Set the parent element to display: flex; and align-items: top;. That forces the direct children of .social to align at the top.
.social {
display: flex;
align-items: top;
}
.social a {
padding: 5px 10px;
margin: 5px;
background-color: yellow;
}
<div class="social">
Facebook
Instagram
Pinterest
Twitter
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="social">
<table>
<tr>
<td>
<button type="button" class="btn btn-info">
<i class="fa fa-twitter" aria-hidden="true"></i>
Tweet </button>
</td>
<td>
<button type="button" class="btn btn-success">
<i class="fa fa-thumbs-up" aria-hidden="true"></i>
Like </button>
</td>
<td>
<button type="button" class="btn btn-success">
<i class="fa fa-thumbs-up" aria-hidden="true"></i>
Share </button>
</td>
<td>
<button type="button" class="btn btn-danger">
<i class="fa fa-thumbs-up" aria-hidden="true"></i>
Save </button>
</td>
</tr>
</table>
</div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
I am wondering how to make a dot for example here https://gyazo.com/b757f6e984c19f7f4fc433f8147a5103 float on top like that I don't understand how I would do this I have tried position absolute and putting it in the which is in the tbody and it has not worked. Here is my code:
<tr>
<th scope="row">
<i class="active"></i>
<p>magic</p>
</th>
<td>magic</td>
<td>magic</td>
<td>
<p>magic</p>
</td>
<td>
<p>magic</p>
</td>
<td>
<div class="dropdown">
<button class="btn dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="material-icons">more_vert</i>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><i class="material-icons"></i>Start</li>
<li><i class="material-icons"></i>Stop</li>
<li><i class="material-icons"></i>Delete</li>
</ul>
</div>
</td>
</tr>
I think you want something like this:
<html>
<head>
<style>
.box {
width: 80%;
height:40px;
background: red;
z-index: 1;
position: absolute;
}
.dot {
width: 25px;
height: 25px;
border-radius: 50%;
background: green;
top: 20%;
right: 0%;
transform: translate(50%);
position: absolute;
}
</style>
</head>
<div class="box"><div class=dot></div></div>
basicly you need to have a dot that should float out of the div right?
In this case, you just need to set position: absolute; then set in what side the dot should be, for example if you want a dot just like in the picture you need to set the right: 0% but it will still be inside the div, so add transform: translate(-50%, 0%) and it will do the job if you have question just comment, hope i solved the problem!
Please See here, you might be looking for this.
Demo: https://plnkr.co/edit/qM6rnLCEtgG3TQkxQjOe?p=preview
<table>
<thead>
<tr>
<th>Name</th>
<th>Ip Address</th>
<th>Created</th>
<th>DataCenter</th>
<th>Tags</th>
<th>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">More_vert
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
Start
</li>
<li>
Stop
</li>
<li>
Delete
</li>
</ul>
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="position:relative;padding-left:20px;">Name_xxx
<div class="circle"></div></td>
<td>123.168.1.40:8080</td>
<td>12-10-2010</td>
<td>ABC_XXX</td>
<td>
<input type="radio">
</td>
<td> </td>
</tr>
</tbody>
</table>
here get an example table code. Hope you helpful.
https://jsfiddle.net/rafalito1989/d6pxf26x/
I have a treetable which columns have an icon and text like this (this is fine)*:
However, when I reduce the width of the screen, this happens:
And I would like to have something like this:
My html is like this:
<tr data-tt-id="2" data-tt-parent-id="1">
<td>
<i class="fa fa-lg fa-file-text-o"></i>
Title
</td>
</tr>
And my js is:
$("#requestForQuotationTable").treetable({
expandable: true,
indent: 15
});
And the code generated by treetable is this:
<tr data-tt-id="2" data-tt-parent-id="1">
<td>
<span class="indenter" style="padding-left: 15px;"></span>
<i class="fa fa-lg fa-file-text-o"></i>
Title
</td>
</tr>
I have tried setting pull-left in the icon as suggested in here, but then it ignores the span.indenter element, getting the icon to the left.
I have also tried this, with no good results either because of the span.indenter.
All what I have tried leads me to think that my problem is with the span.indenter, but I can't figure out a way to solve this.
Edit after Jayababu's response:
<td>
<span class="indenter" style="padding-left: 30px;float: left;"></span>
<span style="float:left">
<i class="fa fa-lg fa-file-text-o" style="vertical-align: middle;"></i>
</span>
<span style="float:left"><a href="javascript:void(0)" style="cursor: pointer;">
hgjkghjk ghjk ghjk ghjk hgjk hgjkghjk</a>
</span>
</td>
looks like this (it's still ignoring the indenter and the text is not looking good =():
*I have created these images from the example in http://ludo.cubicphuse.nl/jquery-treetable/#usage
In the page you have mentioned,the folder image is loading as a background image
for the span.
If you need a design like you have shown in the third screen shot.
Restructuring is the only one solution in your case.
Ideally you need to create 2 elements let it be 2 spans one to hold the image,another to hold the text.Align both the spans with float:left.
Please find the below code snipped,working fine as you need
As we cant display images in the code snippet,i have just colored the indenter and folder icon with red and green.
.folder{
float: left;
background: green;
width: 20px;
height: 20px;
display: inline;
}
.indenter> a{
background: red;
width: 19px;
}
.indenter{
padding-left: 30px;
float: left;
display: inline;
}
.content{
display: inline;
height: auto;
}
<table>
<tbody><tr class="branch ui-droppable expanded selected" data-tt-id="3-1" data-tt-parent-id="3" style="display: table-row;">
<td>
<span class="indenter" > </span>
<span class="folder" >
<i class="fa fa-lg fa-file-text-o" style="vertical-align: middle;"></i>
</span>
<span class="content" ><a href="javascript:void(0)" style="cursor: pointer;">
hgjkghjk ghjk ghjk ghjk hgjk hgjkghjkhgjkghjk ghjk ghjk ghjk hgjk hgjkghjk</a>
</span>
</td>
</tr>
</tbody></table>