logo
down
shadow

Responsive solution for long URLs (that exceed the device width)


Responsive solution for long URLs (that exceed the device width)

Content Index :

Responsive solution for long URLs (that exceed the device width)
Tag : html , By : walshtp
Date : November 24 2020, 05:47 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Set non responsive page width to device width, cross-browser


Tag : javascript , By : Revision17
Date : March 29 2020, 07:55 AM
around this issue First of all, I know that what I'm trying to do here is bad practice, but I dont really have much choice, so please don't answer with "make the page responsive" etc.. , As per OP's request.
Modify your meta tag to this

Responsive Design: max-device-width, max-width and min-device-pixel-ratio


Tag : css , By : George Handlin
Date : March 29 2020, 07:55 AM
should help you out Hidpi only means that 1 css pixel is rendered with 3x3 actual pixels (this varies for devices, iPhone pixel density is 2- so on iPhone 1 css pixel is made from 4 actual LCD pixels.). Websites on galaxy s4 are still rendered as 360x640px with pixel density 3, so you don't need any additional css for HiDPI devices.
you only need to add this meta tag in year head section
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

Force ViewGroup's children move to next line if they exceed the device width


Tag : android , By : simonth
Date : March 29 2020, 07:55 AM
I wish this helpful for you LinearLayout works that way by default. For your purpose you require a FlowLayout.
Romain guy's FlowLayout
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

public class FlowLayout extends ViewGroup {
        private int mHorizontalSpacing;
        private int mVerticalSpacing;
        private Paint mPaint;

        public FlowLayout(Context context, AttributeSet attrs) {
                super(context, attrs);

                TypedArray a = context.obtainStyledAttributes(attrs,
                                R.styleable.FlowLayout);
                try {
                        mHorizontalSpacing = a.getDimensionPixelSize(
                                        R.styleable.FlowLayout_horizontalSpacing, 0);
                        mVerticalSpacing = a.getDimensionPixelSize(
                                        R.styleable.FlowLayout_verticalSpacing, 0);
                } finally {
                        a.recycle();
                }

                mPaint = new Paint();
                mPaint.setAntiAlias(true);
                mPaint.setColor(0xffff0000);
                mPaint.setStrokeWidth(2.0f);
        }

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                int widthSize = MeasureSpec.getSize(widthMeasureSpec)
                                - getPaddingRight();
                int widthMode = MeasureSpec.getMode(widthMeasureSpec);

                boolean growHeight = widthMode != MeasureSpec.UNSPECIFIED;

                int width = 0;
                int height = getPaddingTop();

                int currentWidth = getPaddingLeft();
                int currentHeight = 0;

                boolean breakLine = false;
                boolean newLine = false;
                int spacing = 0;

                final int count = getChildCount();
                for (int i = 0; i < count; i++) {
                        View child = getChildAt(i);
                        measureChild(child, widthMeasureSpec, heightMeasureSpec);

                        LayoutParams lp = (LayoutParams) child.getLayoutParams();
                        spacing = mHorizontalSpacing;
                        if (lp.horizontalSpacing >= 0) {
                                spacing = lp.horizontalSpacing;
                        }

                        if (growHeight
                                        && (breakLine || currentWidth + child.getMeasuredWidth() > widthSize)) {
                                height += currentHeight + mVerticalSpacing;
                                currentHeight = 0;
                                width = Math.max(width, currentWidth - spacing);
                                currentWidth = getPaddingLeft();
                                newLine = true;
                        } else {
                                newLine = false;
                        }

                        lp.x = currentWidth;
                        lp.y = height;

                        currentWidth += child.getMeasuredWidth() + spacing;
                        currentHeight = Math.max(currentHeight, child.getMeasuredHeight());

                        breakLine = lp.breakLine;
                }

                if (!newLine) {
                        height += currentHeight;
                        width = Math.max(width, currentWidth - spacing);
                }

                width += getPaddingRight();
                height += getPaddingBottom();

                setMeasuredDimension(resolveSize(width, widthMeasureSpec),
                                resolveSize(height, heightMeasureSpec));
        }

        @Override
        protected void onLayout(boolean changed, int l, int t, int r, int b) {
                final int count = getChildCount();
                for (int i = 0; i < count; i++) {
                        View child = getChildAt(i);
                        LayoutParams lp = (LayoutParams) child.getLayoutParams();
                        child.layout(lp.x, lp.y, lp.x + child.getMeasuredWidth(), lp.y
                                        + child.getMeasuredHeight());
                }
        }

        @Override
        protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
                boolean more = super.drawChild(canvas, child, drawingTime);
                LayoutParams lp = (LayoutParams) child.getLayoutParams();
                if (lp.horizontalSpacing > 0) {
                        float x = child.getRight();
                        float y = child.getTop() + child.getHeight() / 2.0f;
                        canvas.drawLine(x, y - 4.0f, x, y + 4.0f, mPaint);
                        canvas.drawLine(x, y, x + lp.horizontalSpacing, y, mPaint);
                        canvas.drawLine(x + lp.horizontalSpacing, y - 4.0f, x
                                        + lp.horizontalSpacing, y + 4.0f, mPaint);
                }
                if (lp.breakLine) {
                        float x = child.getRight();
                        float y = child.getTop() + child.getHeight() / 2.0f;
                        canvas.drawLine(x, y, x, y + 6.0f, mPaint);
                        canvas.drawLine(x, y + 6.0f, x + 6.0f, y + 6.0f, mPaint);
                }
                return more;
        }

        @Override
        protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
                return p instanceof LayoutParams;
        }

        @Override
        protected LayoutParams generateDefaultLayoutParams() {
                return new LayoutParams(LayoutParams.WRAP_CONTENT,
                                LayoutParams.WRAP_CONTENT);
        }

        @Override
        public LayoutParams generateLayoutParams(AttributeSet attrs) {
                return new LayoutParams(getContext(), attrs);
        }

        @Override
        protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
                return new LayoutParams(p.width, p.height);
        }

        public static class LayoutParams extends ViewGroup.LayoutParams {
                int x;
                int y;

                public int horizontalSpacing;
                public boolean breakLine;

                public LayoutParams(Context context, AttributeSet attrs) {
                        super(context, attrs);
                        TypedArray a = context.obtainStyledAttributes(attrs,
                                        R.styleable.FlowLayout_LayoutParams);
                        try {
                                horizontalSpacing = a
                                                .getDimensionPixelSize(
                                                                R.styleable.FlowLayout_LayoutParams_layout_horizontalSpacing,
                                                                -1);
                                breakLine = a.getBoolean(
                                                R.styleable.FlowLayout_LayoutParams_layout_breakLine,
                                                false);
                        } finally {
                                a.recycle();
                        }
                }

                public LayoutParams(int w, int h) {
                        super(w, h);
                }
        }

}

33% Width for all device using Bootstrap for Responsive


Tag : css , By : picamiolo
Date : March 29 2020, 07:55 AM
this one helps. Since Bootstrap is defined mobile first, you should be able to just define the xs size, like so:
<div class="row">
    <div class="col-xs-4"></div>
    <div class="col-xs-8"></div>
</div>

Image cannot exceed device width on iPhone 5


Tag : html , By : Shrek Qian
Date : March 29 2020, 07:55 AM
it should still fix some issue You're using flexbox on the image's parent in order to center the image which is going to affect scaling. The default property for flex-shrink will prevent the image from being wider than the container.
Add flex-shrink: 0 to the image. This will still allow the centering to take place but without limiting the size of the image.
.landing-img {
    width: 200%;
    height: auto;
    display: block;
    margin: auto;  
    flex-shrink: 0;  
    max-width: none;               
}
Related Posts Related QUESTIONS :
  • What is the correct semantic HTML markup for a title (book, movie, etc.), according to the spec? Is it an <em> tag
  • How to make an animation in Geoserver or in Leaflet
  • Buttons overlapping when shrinking window
  • Stretch an element to the end of the automatically calculated grid, not just the explicit grid
  • What relation is there between Angular's <ng-content> and ShadowDOM
  • CSS background for div element is not working
  • CSS Marquee: multiple paragraphs overlaps
  • I want to align search bar to extreme right
  • Getting blank white space to the left of content inside pre tags
  • My viewer.html won't load any css and jss files
  • How to apply multiple styles to HTML to only part of a title?
  • Want to make text div transparent on a parallax area
  • Is there a way to make this ID plus descendants CSS rule less specific?
  • Is there a way to drop in a stylesheet to get a Material theme or similar for all form elements on the page?
  • How do I make a sideways L look in html/css?
  • Why won't the color #e67d22e1 display in Safari?
  • How to select specific tag's attribute value with xPath?
  • How to make div rows fill available height
  • How to fix text inside a block that grows
  • svg hexagon halftone pattern
  • How to edit a website's element's background colors using a chromium extention
  • What is the main tag in HTML5 ? How does it differ from body tag?
  • My image is flowing out from my div column. How I can fix it and made the image full-size into div
  • How to draw line in react
  • Why Transition css is not working in child selector css
  • How to modify materialize css select option?
  • How to center some text in a rectangle in CSS?
  • How do I equally space out css grid columns?
  • How to make sure all the parts of a macro are running correctly?
  • How to adjust the zoom of website at different browser at different screen size?
  • Can't set max height on child div properly
  • Why background color is not applying to DIV container?
  • Need to select the first-child
  • No space between attributes in buttons
  • How can I block google from crawling my page, but still let Baidu do it?
  • Rendering html content in matToolTip (Angular)
  • Embedding an iframe when iframe height is variable
  • How to use 'word-break: break-word' with link inside of text?
  • How I can animate circular progress bar from left to right?
  • Angular 6 - How can I hide a div onclick of outside of that div
  • How to fill an inline-block div with a solid color?
  • Form file doesn't align with rest of form
  • How to trim off left and right sides of image evenly as I reduce my screen size? (@media query)
  • How can I password protect a section of a static website?
  • Move a div up when I hover over it
  • Why is "align" not a valid attribute of div but still works?
  • Behavior with height/minHeight and display:flex
  • How can i change my h2 title to <p> text while keeping size and alignment?
  • Hover on the text to change size using CSS
  • How to keep a grid of cols without breaking on a new row?
  • Why is bottom: 0 not enough to move ::after content directly below main content?
  • Why does a React build need to be served? Why can't I just open it in the browser?
  • What is the proper way to target the tab key 'highlight' events on an html element?
  • How to Implement dot and line below the text in CSS?
  • DIVs not properly aligned
  • HTML 'for' tag not working for <p> but works on <label>
  • <p> element does not appear to be within parent <footer> element
  • Why flex container is smaller than its content
  • Center an image and a text in a div
  • .class with display: none -> .class:focus with display: block; causes links to not work
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com