logo
down
shadow

Scale div padding according to screen width


Scale div padding according to screen width

By : wu parkin
Date : November 20 2020, 11:01 PM
help you fix your problem The official answer is this can't be done using CSS alone.
However, you can use something like this for a workaround...
code :
div.dynamic {padding:5vw; border:1px solid;}

@media (min-width: 500px) and (max-width: 599px) {div.dynamic {padding:5vw;}}
@media (min-width: 600px) and (max-width: 699px) {div.dynamic {padding:6vw;}}
@media (min-width: 700px) and (max-width: 799px) {div.dynamic {padding:7vw;}}
@media (min-width: 800px) and (max-width: 899px) {div.dynamic {padding:8vw;}}
@media (min-width: 900px) and (max-width: 999px) {div.dynamic {padding:9vw;}}
@media (min-width: 1000px) and (max-width: 1099px) {div.dynamic {padding:10vw;}}
@media (min-width: 1100px) and (max-width: 1199px) {div.dynamic {padding:11vw;}}
@media (min-width: 1200px) and (max-width: 1299px) {div.dynamic {padding:12vw;}}
@media (min-width: 1300px) and (max-width: 1399px) {div.dynamic {padding:13vw;}}
@media (min-width: 1400px) and (max-width: 1499px) {div.dynamic {padding:14vw;}}
@media (min-width: 1500px) {div.dynamic {padding:15vw;}}
<div class="dynamic">This is the div</div>


Share : facebook icon twitter icon
initial-scale = 1.0 + width= device-width not fitting the whole screen on any mobile

initial-scale = 1.0 + width= device-width not fitting the whole screen on any mobile


By : user3717985
Date : March 29 2020, 07:55 AM
Hope this helps The problem is the main container which has a fixed width, instead of adaptive width based on screen. My guess is that the theme is crap!
Here's a fix:
code :
*,
*:before,
*:after {
  margin: 0pt; 
  padding: 0pt;
  box-sizing: border-box;
}

.content-pad {
  width: 100%;
}
/* Apply this width only to small devices */

@media only screen and (min-width: 320px) {
  .content-pad {
    width: 100%;
  }
}
Using viewport width=device-width, initial-scale=1, maximum-scale=1 doesnt fit my page to my phone screen

Using viewport width=device-width, initial-scale=1, maximum-scale=1 doesnt fit my page to my phone screen


By : Akash Jana
Date : March 29 2020, 07:55 AM
Does that help Couple things:
Your meta viewport tag is simply setting the scale at which the viewport is set to. It has nothing to do with your images.
code :
<img src="index_files/img2.png" width="970">
<img src="index_files/img2.png" style="width: 100%"/>
Place square svg to the center of the screen, scale it to fit the screen's width and height with some constraints

Place square svg to the center of the screen, scale it to fit the screen's width and height with some constraints


By : Sophie
Date : March 29 2020, 07:55 AM
should help you out The following works if the aspect ratio of the SVG is a given. If the aspect ratio of the SVG is dynamic, you have to use JavaScript, I believe.
This snippet works in modern browsers and takes full advantage of the relatively new vmin viewport-percentage length. Browser support is pretty good. For horizontal and vertical centering, the flexbox layout mode is leveraged. Again, browser support is pretty good.
code :
html, body {
  /* ensure that all of the viewport is used */
  width: 100%;
  height: 100%;
  /* ensure that no scrollbars appear */
  margin: 0;
  padding: 0;
  
  /* center SVG horizontally and vertically */
  display: flex;
  align-items: center;
  justify-content: center;
}

#picture {
  /* ensure 1:1 aspect ratio, tweak 50 to make SVG larger */
  width: 50vmin;
  height: 50vmin;  
  /* set some maximum size (width and height need to match
   * aspect ratio, 1:1 in this case */
  max-width: 200px;
  max-height: 200px;
}
<svg id="picture" viewBox="0 0 100 100">
  <circle cx="50" cy="50" r="50"></circle>
</svg>
My width is bigger than my screen, but body and html are set to 0 padding and margin and 100% width

My width is bigger than my screen, but body and html are set to 0 padding and margin and 100% width


By : Stefan Wachmann
Date : March 29 2020, 07:55 AM
I hope this helps you . Are your images what is making your screen width overflow? You can always use box-sizing to help with clearing margins and padding: https://css-tricks.com/box-sizing/
How to determine scale to increase sprite width to screen width

How to determine scale to increase sprite width to screen width


By : Erkan Hmlz
Date : March 29 2020, 07:55 AM
With these it helps It all depends on the aspect ratio of the screen and the size of the object with the SpriteRenderer. You need to scale up the gameobject that holds the spriterenderer by a factor where you take these into consideration.
Related Posts Related Posts :
  • Angular 2 Checkbox Two Way Data Binding
  • Image to Fit Containing Div
  • Fixed width for table first column
  • How can I alter the formatting of pandoc footnote marks?
  • push is not a function Angularjs error
  • Angular2 Call method in Template
  • Stop playing video in iframe when modal is closed
  • Bootstrap. Can't change navbar link color. Even with ID
  • Making a position:absolute div stay in place on page resize
  • Can we reference contents of <defs> across multiple <svg> elements?
  • Kendo Chart Databinding - Local Json Data with schema
  • Box shadow appearing from right to left
  • BEM element nest naming and sass rule
  • How to vertically center text next to image?
  • Responsive full width input with button
  • Make three headings in line. One to be on the left, second on center and third on the right?
  • XPath for all child elements before a certain sibling?
  • How to prevent default Css scroll onclick and allow javascript event only?
  • CSS Media Query not accounting for screen density?
  • How to stop second navbar from overlapping fixed navbar at the top of the page
  • List Indentation same x-cord as header
  • Sending file input doesn't work
  • Flexbox doesn't work in summary tag
  • CSS - mobile responsive issue with absolute positioning
  • Align image slider at the same bottom using css (Slick Carousel library)
  • Input border CSS
  • Define a custom <a> tag in CSS?
  • How to write vertical text from bottom to top without using transform rotate?
  • Text sometimes warping, sometimes not
  • CSS Correctly positioning pseudo element
  • Center Cropping Image
  • How to wrap a block around a div tag?
  • How to make a tight cell around text and expand empty ones?
  • make exact padding on text
  • position:relative started working different than at first (asp.net)
  • Html does not display in 1/2 columns
  • Positioning shapes to website
  • overwrite another tag in CSS
  • How to calculate sum on change?
  • Why do the browsers automatically wrap text of a web page without any indication about how to do it?
  • Sizing and positioning a border property
  • How do I float div's to the bottom of a page?
  • Responsive html with absolute position text inside relative positon picture
  • Flexbox doesn't work in IE 10
  • AngularJS shopping cart app: Disable button when quantity < 2
  • How to select element by order ? - Css
  • How to apply animation on the list items such that during an instance of time only one list item is visible?
  • responsive CSS - display:inline UL breaking into 2 lines, seems to have enough space
  • Reduce space between responsive div or classes html/css3
  • CSS image disappears too fast
  • Spring boot not redirecting to desired page
  • dont know how to make a proper mixin for background
  • Logout form within Bootstrap navbar dropdown
  • how to stack images from bottom up in Django
  • Auto scroll image taller than container on hover (taller image)
  • Is SASS/SCSS a way to make OOCSS?
  • Is there a work around to turning flex items to containers?
  • CSS HTML | Search input has round corners in safari
  • How do I align all my div's in one line?
  • Mvc DropdownList Not working
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com