# Why are ankidroid cards so thin and how to override it with CSS?

**URL:** <https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906>\
**Category:** Help\
**Created:** [September 25, 2024, 1:40pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906 "2024-09-25T13:40:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yagarea](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@yagarea](https://forums.ankiweb.net/u/yagarea)\
**Post date:** [September 25, 2024, 1:40pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/1 "2024-09-25T13:40:00Z")

</div>

I imported this deck zbrojak.ggu.cz to my ankidroid app on my Android 14 phone.

The deck on desktop looks perfect but when I open it on myphone it looks like this:

 ![photo_2024-09-25_15-34-21](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/c/7/c7ebb789f05575ca3c70be51994cc840f9d756d8.jpeg)

this is the template:

```html
<div class="note">
	<div class="card">
		{% for img in images %}
			{{ img }}
		{% endfor %}
		<h2>{{- question -}}</h2>
		<hr>
		{% for a in answers -%}
			<p class="answer">
				<b>{{- a[0] -}})&nbsp;</b>{{- a[1] -}}
			</p>
		{%- endfor %}
	</div>
	<footer>
		<p><abbr title="Vygenerováno {{ date -}}"><b>Otázka {{ name -}}</b><abbr></p>
		<p><a href="https://zbrojak.ggu.cz/">zbrojak.ggu.cz</a> + <a href="https://blackblog.cz/">BlackBlog.cz</a></p>
	</footer>
</div>

```

This is styles:

```css
.note {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-content: space-between;
}

.card {
	display: block;
	padding: 1em;
	max-width: 70%;
	width: 70%;
	margin: auto;
}

.answer {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: stretch;

	margin-top: 1em;
	padding: 0.5em;

	font-size: 0.8em;
	border: 2px solid #000;
	border-radius: 10px;
	background-color: #1E90FF;
	color: white;
	text-align: left;
	font-size: 1.2em;
}

.correct-answer {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: stretch;

	margin-top: 1em;
	padding: 0.5em;

	font-size: 0.8em;
	border: 2px dashed;
	border-color: #013220;
	border-radius: 10px;
	background-color: #008200;
	color: white;
	text-align: left;
	font-size: 1.2em;
}

.large-img {
	display: block;
	width: 100%;
	margin: auto;
	max-width: 600px;
	height: auto;
}

footer {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	width: 100%;
}

a {
	text-decoration: underline;
}

h2 {
	text-align: justify;
}

/* Android */
.android, .android .note, .android .card, .android .answer, .android .correct-answer, .android body {
  width: 100%;
  padding: 2px;
}

```

The cards are supper narrow/thin.  
How can I fix this so cards are wide as the screen?

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [September 25, 2024, 2:15pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/2 "2024-09-25T14:15:32Z")

</div>

The screenshot will definitely help, so try that again. You should just be able to paste that into your message. Post both what it looks like on AnkiDroid, and the expected result, which you get on desktop.

The other thing we need to see is the templates for your note type – front, back, and styling – _as text in a code/preformatted block, please_.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/5/6/560fc0dbf48535fc9c436e9e8560223b0a4ec3c9.png)

---

<div class="post-metadata">

**Author:** ![yagarea](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@yagarea](https://forums.ankiweb.net/u/yagarea)\
**Post date:** [September 25, 2024, 2:22pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/3 "2024-09-25T14:22:42Z")

</div>

Yes, I tried that and all I get is this message:

> Sorry, but your upload failed. Please try again.

Edit: I installed chromium and not it worked

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [September 25, 2024, 2:32pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/4 "2024-09-25T14:32:30Z")

</div>

> The other thing we need to see is the templates for your note type – front, back, and styling – _as text in a code/preformatted block, please_.  
> ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/5/6/560fc0dbf48535fc9c436e9e8560223b0a4ec3c9.png)

---

<div class="post-metadata">

**Author:** ![yagarea](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@yagarea](https://forums.ankiweb.net/u/yagarea)\
**Post date:** [September 25, 2024, 2:33pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/5 "2024-09-25T14:33:11Z")

</div>

I have eddited the question and added the code. Thank you for quick reply.

As you can see in CSS styles I tried to apply special rules for android using this:  
docs.ankiweb (dot) net/templates/styling.html#platform-specific-css

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [September 25, 2024, 2:38pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/6 "2024-09-25T14:38:22Z")

</div>

Thank you! It looks like our updates flew past each other. Hopefully someone will be able to help you with your CSS.

---

<div class="post-metadata">

**Author:** ![Whar](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/whar/32/23290_2.png) [@Whar](https://forums.ankiweb.net/u/Whar)\
**Post date:** [September 26, 2024, 8:44am UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/7 "2024-09-26T08:44:52Z")

</div>

Tell me if this quick fix work or I’ll try again, I can’t check in my phone to see if it works until later (if I can before you answer, I’ll update the post).

Remove the `width` from `.card`:

```auto
.card {
	display: block;
	padding: 1em;
	max-width: 70%;
	margin: auto;
}

```

An in the `android` block replace `width` with `max-width`:

```auto
.android, .android .note, .android .card, .android .answer, .android .correct-answer, .android body {
  max-width: 100%;
  padding: 2px;
}

```

---

<div class="post-metadata">

**Author:** ![yagarea](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@yagarea](https://forums.ankiweb.net/u/yagarea)\
**Post date:** [September 26, 2024, 10:13pm UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/8 "2024-09-26T22:13:09Z")

</div>

Even when I remove all mentions of width it still looks same.

The current styles:

```css

.note {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-content: space-between;
}

.card {
	display: block;
	padding: 1em;
	margin: auto;
}

.answer {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: stretch;

	margin-top: 1em;
	padding: 0.5em;

	font-size: 0.8em;
	border: 2px solid #000;
	border-radius: 10px;
	background-color: #1E90FF;
	color: white;
	text-align: left;
	font-size: 1.2em;
}

.correct-answer {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: stretch;

	margin-top: 1em;
	padding: 0.5em;

	font-size: 0.8em;
	border: 2px dashed;
	border-color: #013220;
	border-radius: 10px;
	background-color: #008200;
	color: white;
	text-align: left;
	font-size: 1.2em;
}

.large-img {
	display: block;
	width: 100%;
	margin: auto;
	max-width: 600px;
	height: auto;
}

footer {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	width: 100%;
}

a {
	text-decoration: underline;
}

h2 {
	text-align: justify;
}

/* Android */
.android, .android .note, .android .card, .android .answer, .android .correct-answer, .android body {
  padding: 2px;
}

```

---

<div class="post-metadata">

**Author:** ![Whar](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/whar/32/23290_2.png) [@Whar](https://forums.ankiweb.net/u/Whar)\
**Post date:** [September 27, 2024, 10:29am UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/9 "2024-09-27T10:29:03Z")

</div>

Hi! I was able to check with my phone today, I found a solution. I mixed up the “widths” earlier (sorry!), I ditched the `max-width` for `width` this time and added another property:

```auto
.card {
	display: block;
	padding: 1em;
	width: 70%;
	margin: auto;
}

```

```auto
.android, .android .note, .android .card, .android .answer, .android .correct-answer, .android body {
 box-sizing: border-box;
 width: 100%;
 padding: 2px;
}

```

I added `box-sizing: border-box;` to avoid the card overflowing the screen. First, I played with the width % (you can too), but wasn’t able to find a nice value. This way, the card will match the phone’s screen width without worrying about margins.

Hope it works for you, here a not-so-nice screenshot:

 ![photo_2024-09-27_12-20-18](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/1/b/1bbcdf1d6ba30ac0d965fe34772ed5d94f29091a.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [October 27, 2024, 10:29am UTC](https://forums.ankiweb.net/t/why-are-ankidroid-cards-so-thin-and-how-to-override-it-with-css/49906/10 "2024-10-27T10:29:23Z")

</div>

Closed on October 27, 2024, 10:29am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
